Update: this question was asked before there was a solution for it already in ActiveAdmin. As Joseph states, the ActiveAdmin documentation now contains this information, but the answers here are provided for those working with older versions of ActiveAdmin.

当strong_参数0.1.4与Rails 3.2.8中的ActiveAdmin 0.5.0一起使用时,如果您使用的模型通过以下方式使用strong_参数:

include ::ActiveModel::ForbiddenAttributesProtection

如果试图创建/编辑记录,则日志(log)中会出现以下错误:

ActiveModel::ForbiddenAttributes (ActiveModel::ForbiddenAttributes)

推荐答案

Ruby-on-rails相关问答推荐

使用RubyZip处理大型压缩文件:65535个文件的限制

在URL中将下划线更改为连字符Ruby on Rails

尽管安装并需要 pry-rails gem,但 Rails 容器内出现未定义方法‘pry’错误

如何通过graphqlMutations 从rails销毁当前用户会话

计算总价(商品数量*商品价格)

只允许用户在 Rails 中输入字母和数字

在bash中匹配带有空格字符的字符串

使用 Ruby On Rails 的多个用户模型,并设计有单独的注册路由,但只有一个共同的登录路由

如何避免 activesupport 中的循环参数引用警告

来自控制台的 ActionCable.server.broadcast

rails s和bundle exec rails s有什么区别?

验证以确保唯一性但忽略空值?

理解 Gemfile.lock:删除 Gemfile.lock 然后再次运行 bundle install 可以吗?

如何将 Ruby 哈希转换为 XML?

用 url_for 查询参数?

rails 模型 has_many 本身

Rails如何对列求和?

activerecord 查找所有未包含在数组中的内容

关于在不适合任何地方的 Rails 应用程序中放置类的指南

如何为rails中的number_field添加默认值?