使用Rails 4.2升级时,Devise会引发错误

Ant*_*com 30 ruby ruby-on-rails devise ruby-on-rails-4

当我跑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)
Run Code Online (Sandbox Code Playgroud)

当我跑rake db:resetdb:migratedb:setup:

rake aborted!
NoMethodError: undefined method `merge!' for #<ActionDispatch::Routing::Mapper::Scope:0x007fca8d3f2780>
Run Code Online (Sandbox Code Playgroud)

spi*_*ann 71

似乎这个问题已经解决了这个PR https://github.com/plataformatec/devise/pull/3153前一段时间.更新应用程序中的devise gem(如果可能).

将您的设计版本更改Gemfile为至少3.4.0:

gem 'devise', '~> 3.4.0'   # or later
Run Code Online (Sandbox Code Playgroud)

然后运行:

bundle update devise
Run Code Online (Sandbox Code Playgroud)

更新:Devise已经更新到版本3.5.x,4.0很快就会发布(请参阅RubyGems.org上的所有版本).这就是说,你可能需要定义至少一个版本3.5.xGemfile:

gem 'devise', '~> 3.5.0'
Run Code Online (Sandbox Code Playgroud)

或者只加载可能的最新版本:

gem 'devise', '> 3.4'
Run Code Online (Sandbox Code Playgroud)

跟着一个 bundle update devise


twm*_*loy 5

最近更新的https://github.com/plataformatec/devise/pull/3153#issuecomment-71185519

Gemfile

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