Permalink
Browse files

Fix for issue 560 where joins could be thrown away by ActiveRecordAda…

…pter::merge_joins
  • Loading branch information...
1 parent 7bf683d commit cfc355c006a3f531e4024e4cd54cbc4740f8635a @DavidMikeSimon committed Jun 19, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/cancan/model_adapters/active_record_adapter.rb
@@ -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

0 comments on commit cfc355c

Please sign in to comment.