lib/authority/user_abilities.rb in authority-2.0.1 vs lib/authority/user_abilities.rb in authority-2.1.0
- old
+ new
@@ -8,11 +8,15 @@
# in order to make that possible.
# All delegate to corresponding methods on the resource.
Authority.verbs.each do |verb|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
- def can_#{verb}?(resource)
- resource.#{Authority.abilities[verb]}_by?(self)
+ def can_#{verb}?(resource, options = {})
+ if options.empty?
+ resource.#{Authority.abilities[verb]}_by?(self)
+ else
+ resource.#{Authority.abilities[verb]}_by?(self, options)
+ end
end
RUBY
end
end