diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-10-05 14:35:01 -0400 |
---|---|---|
committer | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-10-05 17:57:55 -0400 |
commit | cfeabbfdcbc27e78efd9e183ba74a2fc9a7a69a0 (patch) | |
tree | aecc06a965a047ea953f6e46d582bb7c37a32959 /activerecord/lib/active_record | |
parent | 06121631ce5d4b9575d9e8e8e0d2e70e637f0ac6 (diff) | |
download | rails-cfeabbfdcbc27e78efd9e183ba74a2fc9a7a69a0.tar.gz rails-cfeabbfdcbc27e78efd9e183ba74a2fc9a7a69a0.tar.bz2 rails-cfeabbfdcbc27e78efd9e183ba74a2fc9a7a69a0.zip |
Move FixtureSet::ReflectionProxy and FixtureSet::HasManyThroughProxy to FixtureSet::TableRows
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/fixture_set/table_rows.rb | 32 | ||||
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 32 |
2 files changed, 32 insertions, 32 deletions
diff --git a/activerecord/lib/active_record/fixture_set/table_rows.rb b/activerecord/lib/active_record/fixture_set/table_rows.rb index c7227ef133..e8335a2e10 100644 --- a/activerecord/lib/active_record/fixture_set/table_rows.rb +++ b/activerecord/lib/active_record/fixture_set/table_rows.rb @@ -6,6 +6,38 @@ require "active_record/fixture_set/model_metadata" module ActiveRecord class FixtureSet class TableRows # :nodoc: + class ReflectionProxy # :nodoc: + def initialize(association) + @association = association + end + + def join_table + @association.join_table + end + + def name + @association.name + end + + def primary_key_type + @association.klass.type_for_attribute(@association.klass.primary_key).type + end + end + + class HasManyThroughProxy < ReflectionProxy # :nodoc: + def rhs_key + @association.foreign_key + end + + def lhs_key + @association.through_reflection.foreign_key + end + + def join_table + @association.through_reflection.table_name + end + end + def initialize(table_name, model_class:, fixtures:, config:) @table_name = table_name @model_class = model_class diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 9c05843999..b090c76a38 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -667,38 +667,6 @@ module ActiveRecord ).to_hash end - class ReflectionProxy # :nodoc: - def initialize(association) - @association = association - end - - def join_table - @association.join_table - end - - def name - @association.name - end - - def primary_key_type - @association.klass.type_for_attribute(@association.klass.primary_key).type - end - end - - class HasManyThroughProxy < ReflectionProxy # :nodoc: - def rhs_key - @association.foreign_key - end - - def lhs_key - @association.through_reflection.foreign_key - end - - def join_table - @association.through_reflection.table_name - end - end - private def model_class=(class_name) |