Method: ActiveRecord::FixtureSet::TableRows#initialize

Defined in:
lib/active_record/fixture_set/table_rows.rb

#initialize(table_name, model_class:, fixtures:) ⇒ TableRows

Returns a new instance of TableRows.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/active_record/fixture_set/table_rows.rb', line 9

def initialize(table_name, model_class:, fixtures:)
  @model_class = model_class

  # track any join tables we need to insert later
  @tables = Hash.new { |h, table| h[table] = [] }

  # ensure this table is loaded before any HABTM associations
  @tables[table_name] = nil

  build_table_rows_from(table_name, fixtures)
end