Module: Vorpal::ToManyConfig

Included in:
HasManyConfig
Defined in:
lib/vorpal/configs.rb

Instance Method Summary collapse

Instance Method Details

#associate(parent, child) ⇒ Object



259
260
261
262
263
264
# File 'lib/vorpal/configs.rb', line 259

def associate(parent, child)
  if get_children(parent).nil?
    parent.send("#{name}=", [])
  end
  get_children(parent) << child
end

#get_children(parent) ⇒ Object



255
256
257
# File 'lib/vorpal/configs.rb', line 255

def get_children(parent)
  parent.send(name)
end