Devise not working with Rails 4.0

泄露秘密 提交于 2019-12-13 03:15:49

问题


I took the following steps:

rails new routing_test

  • in Gemfile I added devise
  • rails devise g user invoke active_record

    create    db/migrate/20130731191051_devise_create_users.rb
    create    app/models/user.rb
    invoke    rspec
    create      spec/models/user_spec.rb
    invoke      factory_girl
    create        spec/factories/users.rb
    insert    app/models/user.rb
    route  devise_for :users
    

and then, with a simple rake db:migrate, I get the following:

rake aborted!

Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007feb823b6120 @paths=["/Users/krg07/Developer/core2/test/dummy/config/routes.rb", "/Users/krg07/Developer/core2/config/routes.rb"], @route_sets=[#<ActionDispatch::Routing::RouteSet:0x007feb82c5e700>, #<ActionDispatch::Routing::RouteSet:0x007feb82d34440>]>
/Users/krg07/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated'
/Users/krg07/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
/Users/krg07/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'

Any idea what is going on? Thanks, really appreciate it!


回答1:


I had problems getting Devise to work with Rails 4 and found that most of the issues were because I was including an older version of the gem that was not updated to work with Rails 4. Specifying the latest version of the gem helped:

gem 'devise', '3.0.0'

You may need to re-run the Devise installer after the gem has been updated.




回答2:


You are not the only one to have this problem, see the following issue for more informations.



来源:https://stackoverflow.com/questions/17978479/devise-not-working-with-rails-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!