class ActiveRecord::FixtureSet::TableRows
:nodoc:
def build_table_rows_from(table_name, fixtures)
def build_table_rows_from(table_name, fixtures) now = ActiveRecord.default_timezone == :utc ? Time.now.utc : Time.now @tables[table_name] = fixtures.map do |label, fixture| TableRow.new( fixture, table_rows: self, label: label, now: now, ) end end
def initialize(table_name, model_class:, fixtures:)
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
def model_metadata
def model_metadata @model_metadata ||= ModelMetadata.new(model_class) end
def to_hash
def to_hash @tables.transform_values { |rows| rows.map(&:to_hash) } end