Class: ROM::Factory::Attributes::Association::OneToOneThrough Private

Inherits:
Core
  • Object
show all
Defined in:
lib/rom/factory/attributes/association.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from ROM::Factory::Attributes::Association::Core

Instance Method Details

#call(attrs = EMPTY_HASH, parent, persist: true) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/rom/factory/attributes/association.rb', line 135

def call(attrs = EMPTY_HASH, parent, persist: true)
  return if attrs.key?(name)

  struct = if persist && attrs[tpk]
             attrs
           elsif persist
             builder.persistable.create(*traits, **attrs)
           else
             builder.struct(*traits, **attrs)
           end

  assoc.persist([parent], struct) if persist

  {name => struct}
end

#dependency?(rel) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


151
152
153
# File 'lib/rom/factory/attributes/association.rb', line 151

def dependency?(rel)
  assoc.source == rel
end

#through?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


155
156
157
# File 'lib/rom/factory/attributes/association.rb', line 155

def through?
  true
end