Class: Clowne::Adapters::ActiveRecord::Associations::HasMany

Inherits:
Base
  • Object
show all
Defined in:
lib/clowne/adapters/active_record/associations/has_many.rb

Instance Method Summary collapse

Instance Method Details

#call(record) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/clowne/adapters/active_record/associations/has_many.rb', line 8

def call(record)
  with_scope.each do |child|
    child_clone = clone_one(child)
    child_clone[:"#{reflection.foreign_key}"] = nil
    record.__send__(association_name) << child_clone
  end

  record
end