Class: DataMapper::Associations::ManyToOne::Proxy
- Inherits:
-
Object
- Object
- DataMapper::Associations::ManyToOne::Proxy
- Defined in:
- lib/dm-accepts_nested_attributes/association_proxies.rb
Instance Method Summary collapse
Instance Method Details
#save ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dm-accepts_nested_attributes/association_proxies.rb', line 8 def save return false if @parent.nil? # original dm-core-0.9.11 code: # return true unless parent.new_record? # and the backwards compatible extension to it (allows update of belongs_to model) if !parent.new_record? && !@relationship.child_model.autosave_associations.key?(@relationship.name) return true end @relationship.with_repository(parent) do result = parent.marked_for_destruction? ? parent.destroy : parent.save @relationship.child_key.set(@child, @relationship.parent_key.get(parent)) if result result end end |