【发布时间】:2014-07-15 12:37:40
【问题描述】:
我怎样才能对这样的参数使用强参数:
{
... attributes of a model,
related_model_attributes => [
RANDOM_HASH_KEY => { attr_1 => value_1, ... other attributes },
ANOTHER_RANDOM_KEY => { attr_1 => value_1, ... other attributes}
...
]
}
如果我使用像 ff sn-p 这样的普通许可样式:
permit!(... model attributes, related_model_attributes: [{:attr_1, ..other attributes]])
它会在随机散列键上抛出未经允许的错误。
如何将强参数与 has_many 一起使用?
【问题讨论】:
标签: ruby-on-rails-4 nested-attributes has-many strong-parameters