首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >批量分配Rails 4

批量分配Rails 4
EN

Stack Overflow用户
提问于 2013-05-24 05:23:44
回答 1查看 659关注 0票数 0

我需要做什么来更新Rails4的make_voteable gem?

在Rails 4中,attr_accessible已经被移除(与strong_parameters一起)。我找不到通过批量赋值错误停止以下行的代码的位置/位置

代码语言:javascript
复制
 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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-05-24 06:47:53

希望你的旧gem能尽快更新,但同时你可以尝试使用这个gem在你的Rails 4应用程序中恢复protected_attributes:

gem 'protected_attributes'

https://github.com/rails/protected_attributes

也许你可以用'make_voteable‘gem启动你的应用程序。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16724128

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档