aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_scope.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-03-10 19:28:26 +0000
committerJon Leighton <j@jonathanleighton.com>2011-03-10 19:28:26 +0000
commit2d3d9e3531d0d49a94ded10b993640053bd76c03 (patch)
treea5bd6b5e212f6b6863fbdd59dca43d58cdd110e7 /activerecord/lib/active_record/associations/association_scope.rb
parent6490d65234b89d4d28308b72b13d4834fd44bbb3 (diff)
downloadrails-2d3d9e3531d0d49a94ded10b993640053bd76c03.tar.gz
rails-2d3d9e3531d0d49a94ded10b993640053bd76c03.tar.bz2
rails-2d3d9e3531d0d49a94ded10b993640053bd76c03.zip
Rename Reflection#through_reflection_chain and #through_options to Reflection#chain and Reflection#options as they now no longer relate solely to through associations.
Diffstat (limited to 'activerecord/lib/active_record/associations/association_scope.rb')
-rw-r--r--activerecord/lib/active_record/associations/association_scope.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb
index 5df2e964be..cf859bbdee 100644
--- a/activerecord/lib/active_record/associations/association_scope.rb
+++ b/activerecord/lib/active_record/associations/association_scope.rb
@@ -4,7 +4,7 @@ module ActiveRecord
attr_reader :association, :alias_tracker
delegate :klass, :owner, :reflection, :interpolate, :to => :association
- delegate :through_reflection_chain, :through_conditions, :options, :source_options, :to => :reflection
+ delegate :chain, :conditions, :options, :source_options, :to => :reflection
def initialize(association)
@association = association
@@ -50,7 +50,7 @@ module ActiveRecord
def add_constraints(scope)
tables = construct_tables
- through_reflection_chain.each_with_index do |reflection, i|
+ chain.each_with_index do |reflection, i|
table, foreign_table = tables.shift, tables.first
if reflection.source_macro == :has_and_belongs_to_many
@@ -73,10 +73,10 @@ module ActiveRecord
foreign_key = reflection.active_record_primary_key
end
- if reflection == through_reflection_chain.last
+ if reflection == chain.last
scope = scope.where(table[key].eq(owner[foreign_key]))
- through_conditions[i].each do |condition|
+ conditions[i].each do |condition|
if options[:through] && condition.is_a?(Hash)
condition = { table.name => condition }
end
@@ -86,7 +86,7 @@ module ActiveRecord
else
constraint = table[key].eq foreign_table[foreign_key]
- join = inner_join(foreign_table, reflection, constraint, *through_conditions[i])
+ join = inner_join(foreign_table, reflection, constraint, *conditions[i])
scope = scope.joins(join)
end
end
@@ -96,7 +96,7 @@ module ActiveRecord
def construct_tables
tables = []
- through_reflection_chain.each do |reflection|
+ chain.each do |reflection|
tables << alias_tracker.aliased_table_for(
table_name_for(reflection),
table_alias_for(reflection, reflection != self.reflection)