adding :name option to load_and_authorize_resource if it does not match controller - closes #65
This commit is contained in:
@@ -59,6 +59,11 @@ module CanCan
|
||||
#
|
||||
# load_resource :nested => [:publisher, :author]
|
||||
#
|
||||
# [:+name+]
|
||||
# The name of the resource if it cannot be determined from controller (string or symbol).
|
||||
#
|
||||
# load_resource :name => :article
|
||||
#
|
||||
# [:+resource+]
|
||||
# The class to use for the model (string or constant).
|
||||
#
|
||||
@@ -102,6 +107,11 @@ module CanCan
|
||||
# [:+except+]
|
||||
# Does not apply before filter to given actions.
|
||||
#
|
||||
# [:+name+]
|
||||
# The name of the resource if it cannot be determined from controller (string or symbol).
|
||||
#
|
||||
# load_resource :name => :article
|
||||
#
|
||||
# [:+resource+]
|
||||
# The class to use for the model (string or constant). Alternatively pass a symbol
|
||||
# to represent a resource which does not have a class.
|
||||
|
||||
@@ -54,7 +54,7 @@ module CanCan
|
||||
end
|
||||
|
||||
def model_name
|
||||
@params[:controller].sub("Controller", "").underscore.split('/').last.singularize
|
||||
@options[:name] || @params[:controller].sub("Controller", "").underscore.split('/').last.singularize
|
||||
end
|
||||
|
||||
def collection_actions
|
||||
|
||||
Reference in New Issue
Block a user