Fix for issue 560 where joins could be thrown away by ActiveRecordAdapter::merge_joins
This commit is contained in:
parent
7bf683d8f4
commit
cfc355c006
|
@ -145,8 +145,8 @@ module CanCan
|
||||||
# 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user