Devise raises error with Rails 4.2 upgrade

非 Y 不嫁゛ 提交于 2019-12-30 03:41:08

问题


When I run rails s:

/Users/galli01anthony/.rvm/gems/ruby-2.1.3/gems/devise-3.2.4/lib/devise/rails/routes.rb:455:in
`ensure in with_devise_exclusive_scope': undefined method `merge!' for
#<ActionDispatch::Routing::Mapper::Scope:0x007f8743e19020> (NoMethodError)

When I run rake db:reset or db:migrate or db:setup:

rake aborted!
NoMethodError: undefined method `merge!' for #<ActionDispatch::Routing::Mapper::Scope:0x007fca8d3f2780>

回答1:


It seems like the issue was fixed with this PR https://github.com/plataformatec/devise/pull/3153 a while ago. Update the devise gem in your application (if possible).

Change the version of devise in your Gemfile to at least 3.4.0:

gem 'devise', '~> 3.4.0'   # or later

Then run:

bundle update devise

Update: Devise was updated to version 3.5.x a while ago and 4.0 will be released soon (see all version on RubyGems.org). That said you may want to define at least a version 3.5.x in your Gemfile:

gem 'devise', '~> 3.5.0'

Or just load the newest version that is possible:

gem 'devise', '> 3.4'

follow by a bundle update devise




回答2:


recently updated https://github.com/plataformatec/devise/pull/3153#issuecomment-71185519

Gemfile

gem 'devise', github: 'plataformatec/devise'




回答3:


It was still producing the error for me with devise 3.4.1.

Removing :confirmable in the User model fixed the problem.



来源:https://stackoverflow.com/questions/27611947/devise-raises-error-with-rails-4-2-upgrade

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