mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove deprecated attr_accessible mention
This commit is contained in:
parent
9d62ebb0d0
commit
107d199c45
1 changed files with 1 additions and 4 deletions
|
@ -836,17 +836,14 @@ Active Record provides model level support via the `accepts_nested_attributes_f
|
||||||
class Person < ActiveRecord::Base
|
class Person < ActiveRecord::Base
|
||||||
has_many :addresses
|
has_many :addresses
|
||||||
accepts_nested_attributes_for :addresses
|
accepts_nested_attributes_for :addresses
|
||||||
|
|
||||||
attr_accessible :name, :addresses_attributes
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Address < ActiveRecord::Base
|
class Address < ActiveRecord::Base
|
||||||
belongs_to :person
|
belongs_to :person
|
||||||
attr_accessible :kind, :street
|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates an `addresses_attributes=` method on `Person` that allows you to create, update and (optionally) destroy addresses. When using `attr_accessible` or `attr_protected` you must mark `addresses_attributes` as accessible as well as the other attributes of `Person` and `Address` that should be mass assigned.
|
This creates an `addresses_attributes=` method on `Person` that allows you to create, update and (optionally) destroy addresses.
|
||||||
|
|
||||||
### Building the Form
|
### Building the Form
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue