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
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
Relationship callback when added to a collection. This is automatically
 called by any relationship collection when this object is added.