Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `devise_for' in rails action controller

I created a model user with rails generate devise user and then rake db:migrate and then rake routes. Once i did that i know get a error in my home index being a action controller exception. saying:

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

my full trace is:

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

while my routes.eb is:

Kliqq::Application.routes.draw do devise_for :users

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

  root :to => "home#index"
end

should i have a user controller or something too. Thanks, first rails app.

like image 989
Yeddie Avatar asked Jan 26 '11 23:01

Yeddie


1 Answers

The first thing I would do is try restarting the server. Rails doesn't load in the new methods from a gem until it's been restarted.

like image 192
Jeff Peterson Avatar answered Jan 16 '23 10:01

Jeff Peterson