Class: Torque::PostgreSQL::Inheritance::Expander

Inherits:
Object
  • Object
show all
Defined in:
lib/torque/postgresql/inheritance/expander.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, records, targets) ⇒ Expander

Returns a new instance of Expander.



8
9
10
11
12
# File 'lib/torque/postgresql/inheritance/expander.rb', line 8

def initialize(model, records, targets)
  @model = model
  @records = records
  @targets = targets
end

Instance Method Details

#callObject

Load the columns that are missing from each partial record using one query per inherited table



16
17
18
19
20
21
22
# File 'lib/torque/postgresql/inheritance/expander.rb', line 16

def call
  pending.each do |klass, records|
    amend(klass, records, fetch(klass, records.map(&:id)))
  end

  @records
end