Skip to content

Commit

Permalink
rename variables, add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
sevaorlov committed May 7, 2016
1 parent 8ef7073 commit 2767ea5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion activerecord/CHANGELOG.md
@@ -1,7 +1,13 @@
## Rails 5.0.0.rc1 (May 06, 2016) ##

* No changes.
* Merge parent joins for through associations.

Merges parent associations joins for through associations into a scope. Previously joins in association scope were
taken into account only for root associations with that scope.

Fixes #22538.

*Seva Orlov*

## Rails 5.0.0.beta4 (April 27, 2016) ##

Expand Down
Expand Up @@ -158,8 +158,9 @@ def add_constraints(scope, owner, association_klass, refl, chain_head, chain_tai
scope
end

# Merges inner joins from `other` relation to `scope` relation.
def merge_joins(scope, other)
joins_dependency, rest = other.joins_values.partition do |join|
association_joins, rest_joins = other.joins_values.partition do |join|
case join
when Hash, Symbol, Array
true
Expand All @@ -168,7 +169,7 @@ def merge_joins(scope, other)
end
end

join_dependency = ActiveRecord::Associations::JoinDependency.new(other.klass, joins_dependency, rest)
join_dependency = ActiveRecord::Associations::JoinDependency.new(other.klass, association_joins, rest_joins)
scope.joins! join_dependency.join_constraints([], Arel::Nodes::InnerJoin).map(&:joins)
end

Expand Down

0 comments on commit 2767ea5

Please sign in to comment.