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.


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

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


  res = 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)

153
154
155
# File 'lib/rom/factory/attributes/association.rb', line 153

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)

157
158
159
# File 'lib/rom/factory/attributes/association.rb', line 157

def through?
  true
end