考慮:/app/controllers
下Rails可以不看我的控制器
兩個控制器命名爲:
- customers_controller.rb(CustomersController)
- home_controller.rb(HomeController中)
問題:
當我運行rails命令(即rails c
)這就是我得到的:
ruby-1.9.2-p290 :001 > CustomersController
=> CustomersController
ruby-1.9.2-p290 :002 > HomeController
NameError: uninitialized constant HomeController
from /home/aaron/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
from (irb):2
from /home/aaron/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands/console.rb:44:in `start'
from /home/aaron/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands/console.rb:8:in `start'
from /home/aaron/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
那麼最新的交易?爲什麼HomeController
未被我的應用程序識別?
編輯:
我home_controller.rb文件:
class HomeController < ApplicationController
def index
end
def sign_up
end
def faq
end
def terms
end
def privacy
end
def feedback
end
end
即使世界在它的並不多。
請張貼代碼'home_controller.rb'。 – agentfll
@agentfll,代碼已發佈。可能沒有太大的幫助。 – DJTripleThreat