Skip to content

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
Expand Up @@ -145,8 +145,8 @@ def sanitize_sql(conditions)
# Takes two hashes and does a deep merge.
def merge_joins(base, add)
add.each do |name, nested|
if base[name].is_a?(Hash) && !nested.empty?
merge_joins(base[name], nested)
if base[name].is_a?(Hash)
merge_joins(base[name], nested) unless nested.empty?
else
base[name] = nested
end
Expand Down

0 comments on commit cfc355c

Please sign in to comment.