adding a before filter for loading and authorizing a resource

This commit is contained in:
Ryan Bates
2009-11-16 19:00:10 -08:00
parent 6c6a57beec
commit 1034c81763
3 changed files with 61 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ module CanCan
base.alias_action :edit, :to => :update
end
def can?(original_action, target)
def can?(original_action, target) # TODO this could use some refactoring
(self.class.can_history || []).reverse.each do |can_action, can_target, can_block|
possible_actions_for(original_action).each do |action|
if (can_action == :manage || can_action == action) && (can_target == :all || can_target == target || target.kind_of?(can_target))