Skip to content

Instantly share code, notes, and snippets.

View achiurizo's full-sized avatar
🌞

Arthur Chiu achiurizo

🌞
View GitHub Profile
# Add a new child to this person
@person.children_attributes = [ { :name => 'Son' } ]
@person.children #=> [ <#Person: name: 'Son'> ]
@person.children.clear
# Add two new children to this person
@person.children_attributes =
[ { :name => 'Son' }, { :name => 'Daughter' } ]
@person.save
@person.children #=> [ <#Person: name: 'Son'>, <#Person: name: 'Daughter'> ]