aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-17 15:40:13 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-17 15:40:13 -0700
commit3cb2c14f87c536fde0b04d6b14385d3b730a84ff (patch)
tree819ef0f5a39f328b8ff6bfe0bd78fa27f5c5d558 /activerecord/lib/active_record
parent9933ab1b28b1c001348e8cb8045084ede72fcf89 (diff)
parent18fe96cc168927a6508478f9ad127d57c1ad56dd (diff)
downloadrails-3cb2c14f87c536fde0b04d6b14385d3b730a84ff.tar.gz
rails-3cb2c14f87c536fde0b04d6b14385d3b730a84ff.tar.bz2
rails-3cb2c14f87c536fde0b04d6b14385d3b730a84ff.zip
Merge branch 'master' into experiment
* master: stop doing assingments in an iterator
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency/join_association.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb
index e4d17451dc..b81aecb4e5 100644
--- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb
+++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb
@@ -106,12 +106,16 @@ module ActiveRecord
]
end
- scope_chain_items.each do |item|
+ constraint = scope_chain_items.inject(constraint) do |chain, item|
unless item.is_a?(Relation)
item = ActiveRecord::Relation.new(reflection.klass, table).instance_exec(self, &item)
end
- constraint = constraint.and(item.arel.constraints) unless item.arel.constraints.empty?
+ if item.arel.constraints.empty?
+ chain
+ else
+ chain.and(item.arel.constraints)
+ end
end
manager.from(join(table, constraint))