Class: Vorpal::LookupByFk

Inherits:
Object
  • Object
show all
Defined in:
lib/vorpal/db_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, fk_info, fk_values) ⇒ LookupByFk

Returns a new instance of LookupByFk.



135
136
137
138
139
# File 'lib/vorpal/db_loader.rb', line 135

def initialize(config, fk_info, fk_values)
  @config = config
  @fk_info = fk_info
  @fk_values = fk_values
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



134
135
136
# File 'lib/vorpal/db_loader.rb', line 134

def config
  @config
end

Instance Method Details

#load_all(db_driver) ⇒ Object



141
142
143
144
# File 'lib/vorpal/db_loader.rb', line 141

def load_all(db_driver)
  return [] if @fk_values.empty?
  db_driver.load_by_foreign_key(@config.db_class, @fk_values, @fk_info)
end