2011-01-26 9 views
7

rails generate devise userでモデルユーザを作成し、次にrake db:migrateとrake routesを作成しました。いったん私がそれをしたら、私の家のインデックスにアクションコントローラの例外としてエラーが出るのを知っています。言って:railsアクションコントローラの定義されていないメソッド `devise_for '

undefined method `devise_for' for #< ActionDispatch::Routing::Mapper:0x105371120> 

私の完全なトレースがある:

config/routes.rb:2 
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:233:in `instance_exec' 
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:233:in `draw' 
config/routes.rb:1 
activesupport (3.0.3) lib/active_support/dependencies.rb:235:in `load' 
activesupport (3.0.3) lib/active_support/dependencies.rb:235:in `load' 
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency' 
activesupport (3.0.3) lib/active_support/dependencies.rb:596:in `new_constants_in' 
activesupport (3.0.3) lib/active_support/dependencies.rb:225:in `load_dependency' 
activesupport (3.0.3) lib/active_support/dependencies.rb:235:in `load' 
railties (3.0.3) lib/rails/application.rb:127:in `reload_routes!' 
railties (3.0.3) lib/rails/application.rb:127:in `each' 
railties (3.0.3) lib/rails/application.rb:127:in `reload_routes!' 
railties (3.0.3) lib/rails/application.rb:120:in `routes_reloader' 
activesupport (3.0.3) lib/active_support/file_update_checker.rb:32:in `call' 
activesupport (3.0.3) lib/active_support/file_update_checker.rb:32:in `execute_if_updated' 
railties (3.0.3) lib/rails/application/finisher.rb:51:in `_callback_before_5' 
activesupport (3.0.3) lib/active_support/callbacks.rb:419:in `_run_prepare_callbacks' 
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:45:in `call' 
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in `_run_call_callbacks' 
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in `call' 
rack (1.2.1) lib/rack/sendfile.rb:107:in `call' 
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call' 
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call' 
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call' 
rack (1.2.1) lib/rack/runtime.rb:17:in `call' 
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
rack (1.2.1) lib/rack/lock.rb:11:in `call' 
rack (1.2.1) lib/rack/lock.rb:11:in `synchronize' 
rack (1.2.1) lib/rack/lock.rb:11:in `call' 
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call' 
railties (3.0.3) lib/rails/application.rb:168:in `call' 
railties (3.0.3) lib/rails/application.rb:77:in `send' 
railties (3.0.3) lib/rails/application.rb:77:in `method_missing' 
rack (1.2.1) lib/rack/content_length.rb:13:in `call' 
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start' 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start' 
rack (1.2.1) lib/rack/handler/webrick.rb:13:in `run' 
rack (1.2.1) lib/rack/server.rb:213:in `start' 
railties (3.0.3) lib/rails/commands/server.rb:65:in `start' 
railties (3.0.3) lib/rails/commands.rb:30 
railties (3.0.3) lib/rails/commands.rb:27:in `tap' 
railties (3.0.3) lib/rails/commands.rb:27 
script/rails:6:in `require' 
script/rails:6 

私routes.ebであるのに対し:

Kliqq :: Application.routes.drawは devise_forを実行します。ユーザー

get "home/index" 
    get "welcome/index"  

    root :to => "home#index" 
end 

私にはユーザーコントローラなどが必要ですか?ありがとう、最初のレールアプリ。

+0

あなたはdevise:installを実行しましたか? – ryudice

+0

はい私はdevise:installを実行しました。私もgemfileに持っています – Yeddie

答えて

44

最初に行うことは、サーバーを再起動することです。 Railsは新しいメソッドでは宝石から再起動されるまでロードされません。

+0

実際に私のために同じ問題が解決されました - ありがとう+1: – GeekedOut

+0

それはまた私が問題を解決するのを助けました。ありがとう! – Eytan