diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-02-13 12:13:32 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2014-02-13 12:13:32 -0500 |
commit | 24fc74c0ed076d670018f1ae3705d495aeddbec2 (patch) | |
tree | 42e3bf95097f8af7e356c3cf3dd3975fcab5d4e4 /activerecord | |
parent | f2dfa83fac5e892335d2bceaa6dfe344515fee26 (diff) | |
parent | c3872522895dc98be0081c4457f834951dbd11bc (diff) | |
download | rails-24fc74c0ed076d670018f1ae3705d495aeddbec2.tar.gz rails-24fc74c0ed076d670018f1ae3705d495aeddbec2.tar.bz2 rails-24fc74c0ed076d670018f1ae3705d495aeddbec2.zip |
Merge pull request #14045 from arthurnn/kill_fibers
Dont use Enumarator on join_association
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency/join_association.rb | 6 |
1 files changed, 4 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 0cd2e1a816..cee3c9999f 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -25,7 +25,8 @@ module ActiveRecord joins = [] tables = tables.reverse - scope_chain_iter = scope_chain.reverse_each + scope_chain_index = 0 + scope_chain = scope_chain.reverse # The chain starts with the target table, but we want to end with it here (makes # more sense in this context), so we reverse @@ -44,13 +45,14 @@ module ActiveRecord constraint = build_constraint(klass, table, key, foreign_table, foreign_key) - scope_chain_items = scope_chain_iter.next.map do |item| + scope_chain_items = scope_chain[scope_chain_index].map do |item| if item.is_a?(Relation) item else ActiveRecord::Relation.create(klass, table).instance_exec(node, &item) end end + scope_chain_index += 1 scope_chain_items.concat [klass.send(:build_default_scope)].compact |