【问题标题】:Devise raises error with Rails 4.2 upgrade设计引发 Rails 4.2 升级错误
【发布时间】:2015-02-21 02:22:18
【问题描述】:

当我运行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)

当我运行rake db:resetdb:migratedb:setup 时:

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

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-4 devise


    【解决方案1】:

    似乎该问题已在不久前通过此 PR https://github.com/plataformatec/devise/pull/3153 解决。更新应用程序中的设计 gem(如果可能)。

    Gemfile 中的 devise 版本至少更改为 3.4.0:

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

    然后运行:

    bundle update devise
    

    更新:Devise 不久前已更新至版本3.5.x4.0 即将发布(请参阅RubyGems.org 上的所有版本)。也就是说,您可能希望在您的Gemfile 中至少定义一个版本3.5.x

    gem 'devise', '~> 3.5.0'
    

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

    gem 'devise', '> 3.4'
    

    关注bundle update devise

    【讨论】:

      【解决方案2】:

      使用设计 3.4.1 时它仍然为我产生错误。

      删除用户模型中的:confirmable 解决了这个问题。

      【讨论】:

        【解决方案3】:

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

        Gemfile

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

        【讨论】:

        • 谢谢,我使用的是 Rails 4.2.1 .. 这对我有用。
        猜你喜欢
        • 1970-01-01
        • 2015-03-01
        • 2017-08-06
        • 2015-03-14
        • 1970-01-01
        • 2015-05-15
        • 2015-03-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多