module Couchbase::Model::Relationship::Child
Public Instance Methods
create_with_parent_id(options = {})
click to toggle source
# File lib/couchbase/model/relationship/child.rb, line 8 def create_with_parent_id(options = {}) if id.blank? && parent.present? @id = prefixed_id(parent.id) end # Should this only fire if we had a parent and assigned the id? begin create_without_parent_id(options) rescue Couchbase::Error::KeyExists => error if ok_to_merge_on_key_exists_error? on_key_exists_merge_from_db! save # Can't retry because that still tries 'add' else raise error end end end
Private Instance Methods
ok_to_merge_on_key_exists_error?()
click to toggle source
# File lib/couchbase/model/relationship/child.rb, line 27 def ok_to_merge_on_key_exists_error? respond_to?(:on_key_exists_merge_from_db!) && parent.present? && id == prefixed_id(parent.id) end