Permalink
Browse files

a convenience method to simplify something we do all the time

  • Loading branch information...
bokmann
bokmann committed Apr 14, 2010
1 parent 22693e3 commit b44ff91c80d4597d6b2daf9fd218742998686e20
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/stonewall/stonewall.rb
View
@@ -33,5 +33,15 @@ class << self
def send?(method, user = User.current)
self.class.stonewall.allowed?(self, user, method)
end
+ alias_method :allowed?, :send?
+
+ def send_method_group?(group_name, user = User.current)
+ self.class.stonewall.method_groups[group_name].each do |method|
+ return false unless self.send?(method, user)
+ end
+ return true
+ end
+ alias_method :allowed_method_group?, :send_method_group?
+
end
end

0 comments on commit b44ff91

Please sign in to comment.