Method: VirtualBox::SharedFolder#added_to_relationship

Defined in:
lib/virtualbox/shared_folder.rb

#added_to_relationship(proxy) ⇒ Object

Relationship callback when added to a collection. This is automatically called by any relationship collection when this object is added.



193
194
195
196
197
198
199
200
201
# File 'lib/virtualbox/shared_folder.rb', line 193

def added_to_relationship(proxy)
  was_clean = parent.nil? && !changed?

  write_attribute(:parent, proxy.parent)
  write_attribute(:parent_collection, proxy)

  # This keeps existing records not dirty when added to collection
  clear_dirty! if !new_record? && was_clean
end