Adding clear_aliased_actions to Ability which removes previously defined actions including defaults

This commit is contained in:
Ryan Bates
2009-12-30 18:01:40 -08:00
parent f99d506050
commit 7d3b4cdbc2
3 changed files with 18 additions and 10 deletions

View File

@@ -160,12 +160,18 @@ module CanCan
aliased_actions[target] += args
end
private
# Returns a hash of aliased actions. The key is the target and the value is an array of actions aliasing the key.
def aliased_actions
@aliased_actions ||= default_alias_actions
end
# Removes previously aliased actions including the defaults.
def clear_aliased_actions
@aliased_actions = {}
end
private
def default_alias_actions
{
:read => [:index, :show],