0

Rails 4 の make_voteable gem を更新するにはどうすればよいですか?

Rails 4 では、その代わりに attr_accessible が (strong_parameters とともに) 削除されました。大量割り当てエラーにより、下の行を停止するためにコードを配置する場所/場所が見つかりません

 C:>rails s
 C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activemodel-4.0.0.rc1/lib/active_model/deprecated_mass_assignment_security.rb:14:in `attr_accessible': `attr_accessible` is extracted out of Rails into
 a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one. (RuntimeError)

一括割り当てを許可する必要があることはわかっていますが、これらがコントローラーではなくモジュールであることを考えると、どこでそれを行うべきかわかりません。

https://github.com/medihack/make_voteable

4

1 に答える 1

1

古い gem がすぐに更新されることを願っていますが、それまでの間、この gem を使用して Rails 4 アプリで protected_attributes を復活させることができます。

gem 'protected_attributes'

https://github.com/rails/protected_attributes

おそらくこれで、利用可能な 'make_voteable' gem でアプリを起動できます。

于 2013-05-23T22:47:52.600 に答える