allow SQL conditions to be used with a block
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ module CanCan
|
||||
@actions = [action].flatten
|
||||
@subjects = [subject].flatten
|
||||
@attributes = [extra_args.shift].flatten if extra_args.first.kind_of?(Symbol) || extra_args.first.kind_of?(Array) && extra_args.first.first.kind_of?(Symbol)
|
||||
raise Error, "You are not able to supply a block with a hash of conditions in #{action} #{subject} ability. Use either one." if extra_args.first && !block.nil?
|
||||
raise Error, "You are not able to supply a block with a hash of conditions in #{action} #{subject} ability. Use either one." if extra_args.first.kind_of?(Hash) && !block.nil?
|
||||
@conditions = extra_args.first || {}
|
||||
@block = block
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user