Class: ActiveRecord::FixtureSet::TableRows
- Defined in:
- activerecord/lib/active_record/fixture_set/table_rows.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
-
#initialize(table_name, model_class:, fixtures:, config:) ⇒ TableRows
constructor
A new instance of TableRows.
- #model_metadata ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(table_name, model_class:, fixtures:, config:) ⇒ TableRows
Returns a new instance of TableRows.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'activerecord/lib/active_record/fixture_set/table_rows.rb', line 9 def initialize(table_name, model_class:, fixtures:, config:) @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, config) end |
Instance Attribute Details
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class
21 22 23 |
# File 'activerecord/lib/active_record/fixture_set/table_rows.rb', line 21 def model_class @model_class end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables
21 22 23 |
# File 'activerecord/lib/active_record/fixture_set/table_rows.rb', line 21 def tables @tables end |
Instance Method Details
#model_metadata ⇒ Object
27 28 29 |
# File 'activerecord/lib/active_record/fixture_set/table_rows.rb', line 27 def @model_metadata ||= ModelMetadata.new(model_class) end |