From cfeabbfdcbc27e78efd9e183ba74a2fc9a7a69a0 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Fri, 5 Oct 2018 14:35:01 -0400 Subject: Move FixtureSet::ReflectionProxy and FixtureSet::HasManyThroughProxy to FixtureSet::TableRows --- .../lib/active_record/fixture_set/table_rows.rb | 32 ++++++++++++++++++++++ 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) -- cgit v1.2.3