简体   繁体   English

Rails 5安装错误(DEPRECATION警告:不推荐使用alias_method_chain)

[英]Rails 5 install error (DEPRECATION WARNING: alias_method_chain is deprecated)

I'm running into this error after installing rails 5.0.0 on my project. 在我的项目上安装rails 5.0.0后,我遇到了这个错误。 I'm starting to think it's Devise gem or something. 我开始认为它是Devise gem或者其他东西。 I tried multiple ways, but can't seem to figure it out. 我尝试了多种方法,但似乎无法弄明白。 I've tried this for devise gem, but same result. 我试过这个设计宝石,但结果相同。

gem 'devise', :github => 'plataformatec/devise', :branch => 'master' gem'depaise',:github =>'plataformatec / devise',: branch =>'master'

DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from <top (required)> at /home/nitrous/code/uvesty/config/environment.rb:5)
Exiting
/home/nitrous/code/uvesty/.bundle/gems/actionpack-5.0.0/lib/action_dispatch/middleware/stack.rb:108:in `assert_index': No such middleware to insert after: ActionDispatch::ParamsParser (RuntimeError

I also thought I might need to change all my 我还以为我可能需要改变我的全部

@user = User.find(params[:id])

to

@user = User.find_by(id: params[:id])

First change devise declaration in Gemfile like 首先在Gemfile中更改设计声明

gem "devise", '~> 4.0.0.rc1'

Secondly, you don't need to change this line, as find method is NOT deprecated. 其次,您不需要更改此行,因为推荐使用find方法。

@user = User.find(params[:id])

Please check what new in rails 5 请检查导轨5中的新功能

The issue was the gem rails_admin. 问题是gem rails_admin。 I removed it and it's all fine now. 我删除它,现在一切都很好。 It seems they might have not updated their gem for rails 5.0. 看来他们可能还没有为rails 5.0更新他们的gem。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM