Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

stop doing assingments in an iterator

  • Loading branch information...
commit 18fe96cc168927a6508478f9ad127d57c1ad56dd 1 parent 2eecc0d
@tenderlove tenderlove authored
View
8 activerecord/lib/active_record/associations/join_dependency/join_association.rb
@@ -106,12 +106,16 @@ def join_to(manager)
]
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))
Please sign in to comment.
Something went wrong with that request. Please try again.