我是Rails的新手,我正在尝试使用“ devise”构建用户身份验证系统,但是失败了。我正在关注Rails Girls Guides的教程,该教程使用gem'devise'添加身份验证。一旦进入第5步(即设置用户模型),我在运行后会收到此错误rake db:migrate
rake aborted!
NoMethodError: undefined method `merge!' for #<ActionDispatch::Routing::Mapper::Scope:0x007fd3397a7448>
/Users/.rvm/gems/ruby-2.1.2/gems/devise-3.0.4/lib/devise/rails/routes.rb:420:in `ensure in with_devise_exclusive_scope'
/Users/.rvm/gems/ruby-2.1.2/gems/devise-3.0.4/lib/devise/rails/routes.rb:420:in `with_devise_exclusive_scope'
/Users/.rvm/gems/ruby-2.1.2/gems/devise-3.0.4/lib/devise/rails/routes.rb:233:in `block (2 levels) in devise_for'
/Users/.rvm/gems/ruby-2.1.2/gems/devise-3.0.4/lib/devise/rails/routes.rb:336:in `block in devise_scope'
有谁解决了这个错误?我研究了所有解决方案,例如在安装devise之前不生成用户模型,运行bundle install,运行rails g devise:install等。到目前为止,当我尝试将devise用于Rails 4.0时,没有任何工作。
此外,是否有人对我可以遵循哪些教程来构建身份验证系统提出建议?到目前为止,我已经尝试了很多,但都没有成功。
这似乎是先前3.4.0版设计的已知错误。
升级它应该会使此错误消失。
为此,请编辑您的Gemfile
位置gem "devise" <might have some other stuff in front>
并将其更改为gem "devise", '~> 3.4.1'
然后运行bundle update devise
,您就完成了。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句