Module: Couchbase::Model::Relationship::Child
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/couchbase/model/relationship/child.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#create_with_parent_id(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/couchbase/model/relationship/child.rb', line 8 def create_with_parent_id( = {}) 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() 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 |