module Spree::Admin::BaseControllerDecorator

Public Instance Methods

unauthorized() click to toggle source

Redirect as appropriate when an access request fails. The default action is to redirect to the login screen. Override this method in your controllers if you want to have special behavior in case the user is not authorized to access the requested action. For example, a popup window might simply close itself.

# File lib/controllers/backend/spree/admin/base_controller_decorator.rb, line 5
def unauthorized
  if try_spree_current_user
    flash[:error] = Spree.t(:authorization_failure)
    redirect_to spree.admin_unauthorized_path
  else
    store_location
    redirect_to spree.admin_login_path
  end
end

Protected Instance Methods

model_class() click to toggle source
# File lib/controllers/backend/spree/admin/base_controller_decorator.rb, line 17
def model_class
  const_name = controller_name.classify
  if Spree.const_defined?(const_name, false)
    return "Spree::#{const_name}".constantize
  end
  nil
end