support no arguments to 'can' definition which always calls block

This commit is contained in:
Ryan Bates
2010-09-02 14:46:38 -07:00
parent b1fb179aaf
commit 66314a89f8
3 changed files with 30 additions and 6 deletions

View File

@@ -117,7 +117,7 @@ module CanCan
# can :read, :stats
# can? :read, :stats # => true
#
def can(action, subject, conditions = nil, &block)
def can(action = nil, subject = nil, conditions = nil, &block)
can_definitions << CanDefinition.new(true, action, subject, conditions, block)
end
@@ -133,7 +133,7 @@ module CanCan
# product.invisible?
# end
#
def cannot(action, subject, conditions = nil, &block)
def cannot(action = nil, subject = nil, conditions = nil, &block)
can_definitions << CanDefinition.new(false, action, subject, conditions, block)
end