Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Fix for issue 560 where joins could be thrown away by ActiveRecordAda…
Browse files Browse the repository at this point in the history
…pter::merge_joins
  • Loading branch information
DavidMikeSimon committed Jun 19, 2012
1 parent 7bf683d commit cfc355c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cancan/model_adapters/active_record_adapter.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def sanitize_sql(conditions)
# Takes two hashes and does a deep merge. # Takes two hashes and does a deep merge.
def merge_joins(base, add) def merge_joins(base, add)
add.each do |name, nested| add.each do |name, nested|
if base[name].is_a?(Hash) && !nested.empty? if base[name].is_a?(Hash)
merge_joins(base[name], nested) merge_joins(base[name], nested) unless nested.empty?
else else
base[name] = nested base[name] = nested
end end
Expand Down

0 comments on commit cfc355c

Please sign in to comment.