Issue #687: cancan inserting "AND (NULL)" at the end of sql

Ensure that empty conditions does not trigger unmergeable conditions
This commit is contained in:
jonathangreenberg
2012-10-24 05:36:41 -04:00
parent 3b50fedd5d
commit f5b3fcd8db
3 changed files with 27 additions and 1 deletions

View File

@@ -55,7 +55,8 @@ module CanCan
end
def unmergeable?
@conditions.respond_to?(:keys) && (! @conditions.keys.first.kind_of? Symbol)
@conditions.respond_to?(:keys) && @conditions.present? &&
(!@conditions.keys.first.kind_of? Symbol)
end
def associations_hash(conditions = @conditions)