aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb6
-rw-r--r--activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb2
-rw-r--r--activerecord/lib/active_record/associations/through_association.rb4
3 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
index 46adc048b8..4608ffad67 100644
--- a/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
+++ b/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
@@ -7,7 +7,7 @@ module ActiveRecord
target_id = @target.send(@reflection.association_primary_key).to_s
foreign_key = @owner.send(@reflection.foreign_key).to_s
target_type = @target.class.base_class.name
- foreign_type = @owner.send(@reflection.options[:foreign_type]).to_s
+ foreign_type = @owner.send(@reflection.foreign_type).to_s
target_id != foreign_key || target_type != foreign_type
else
@@ -19,7 +19,7 @@ module ActiveRecord
def replace_keys(record)
super
- @owner[@reflection.options[:foreign_type]] = record && record.class.base_class.name
+ @owner[@reflection.foreign_type] = record && record.class.base_class.name
end
def different_target?(record)
@@ -31,7 +31,7 @@ module ActiveRecord
end
def target_klass
- type = @owner[@reflection.options[:foreign_type]]
+ type = @owner[@reflection.foreign_type]
type && type.constantize
end
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
index 1e5149d80f..3fea24ebf8 100644
--- a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
+++ b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
@@ -228,7 +228,7 @@ module ActiveRecord
second_key = source_reflection.association_foreign_key
jt_conditions <<
- join_table[reflection.source_reflection.options[:foreign_type]].
+ join_table[reflection.source_reflection.foreign_type].
eq(reflection.options[:source_type])
else
second_key = source_reflection.foreign_key
diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb
index c78f5d969f..6536fb44b2 100644
--- a/activerecord/lib/active_record/associations/through_association.rb
+++ b/activerecord/lib/active_record/associations/through_association.rb
@@ -71,7 +71,7 @@ module ActiveRecord
@reflection.klass.primary_key
source_primary_key = @reflection.source_reflection.foreign_key
if @reflection.options[:source_type]
- column = @reflection.source_reflection.options[:foreign_type]
+ column = @reflection.source_reflection.foreign_type
conditions <<
right[column].eq(@reflection.options[:source_type])
end
@@ -105,7 +105,7 @@ module ActiveRecord
}
if @reflection.options[:source_type]
- join_attributes.merge!(@reflection.source_reflection.options[:foreign_type] => associate.class.base_class.name)
+ join_attributes.merge!(@reflection.source_reflection.foreign_type => associate.class.base_class.name)
end
if @reflection.through_reflection.options[:conditions].is_a?(Hash)