Method: Her::Model::Associations::BelongsToAssociation#create
- Defined in:
- lib/her/model/associations/belongs_to_association.rb
#create(attributes = {}) ⇒ Object
Create a new object, save it and associate it to the parent
66 67 68 69 70 |
# File 'lib/her/model/associations/belongs_to_association.rb', line 66 def create(attributes = {}) resource = build(attributes) @parent.attributes[@name] = resource if resource.save resource end |