mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
remove Mass Assignment reference from Form Helpers guide [ci skip]
This commit is contained in:
parent
46d63d5b20
commit
1e83730067
1 changed files with 1 additions and 1 deletions
|
@ -458,7 +458,7 @@ As with other helpers, if you were to use the `select` helper on a form builder
|
|||
<%= f.select(:city_id, ...) %>
|
||||
```
|
||||
|
||||
WARNING: If you are using `select` (or similar helpers such as `collection_select`, `select_tag`) to set a `belongs_to` association you must pass the name of the foreign key (in the example above `city_id`), not the name of association itself. If you specify `city` instead of `city_id` Active Record will raise an error along the lines of ` ActiveRecord::AssociationTypeMismatch: City(#17815740) expected, got String(#1138750) ` when you pass the `params` hash to `Person.new` or `update_attributes`. Another way of looking at this is that form helpers only edit attributes. You should also be aware of the potential security ramifications of allowing users to edit foreign keys directly. You may wish to consider the use of `attr_protected` and `attr_accessible`. For further details on this, see the [Ruby On Rails Security Guide](security.html#mass-assignment).
|
||||
WARNING: If you are using `select` (or similar helpers such as `collection_select`, `select_tag`) to set a `belongs_to` association you must pass the name of the foreign key (in the example above `city_id`), not the name of association itself. If you specify `city` instead of `city_id` Active Record will raise an error along the lines of ` ActiveRecord::AssociationTypeMismatch: City(#17815740) expected, got String(#1138750) ` when you pass the `params` hash to `Person.new` or `update_attributes`. Another way of looking at this is that form helpers only edit attributes. You should also be aware of the potential security ramifications of allowing users to edit foreign keys directly.
|
||||
|
||||
### Option Tags from a Collection of Arbitrary Objects
|
||||
|
||||
|
|
Loading…
Reference in a new issue