Strong Parameters in Rails 3.2.8

前端 未结 2 842
离开以前
离开以前 2020-12-14 09:09

This video states that it is possible to protect the input coming in via the controller yet still be able to do mass assignment via models and specs. However, I have not se

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 10:00

    It isn't the same as your issue but it may come up for someone else getting MassAssignmentSecurity::Error. I've hit an issue that 'id' and 'type' attributes seem to be protected by default even when I had taken the prescribed steps to switch to using strong parameters rather than mass assignment protection. I had an association named 'type' which I renamed to 'project_type' to resolve the problem (the attribute was already project_type_id).

提交回复
热议问题