authorize! :admin, model
以下代码中的行是什么意思?我在代码中的任何地方都找不到该:admin
操作。这类似于:manage
选项吗?
spree_auth-1.0.3/app/controllers/spree/admin/admin_controller_decorator.rb:
require File.expand_path('../../base_controller_decorator', __FILE__)
Spree::Admin::BaseController.class_eval do
before_filter :authorize_admin
def authorize_admin
begin
model = model_class
rescue
model = Object
end
authorize! :admin, model
authorize! params[:action].to_sym, model
end
protected
def model_class
"Spree::#{controller_name.classify}".constantize
end
end