Sha256: 0670c4019b937bba478de57c059340cfdff366db84540ece3319fd5783f5a653
Contents?: true
Size: 875 Bytes
Versions: 17
Compression:
Stored size: 875 Bytes
Contents
module Spree::Admin::BaseControllerDecorator # 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. 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 def model_class const_name = controller_name.classify if Spree.const_defined?(const_name, false) return "Spree::#{const_name}".constantize end nil end end Spree::Admin::BaseController.prepend(Spree::Admin::BaseControllerDecorator)
Version data entries
17 entries across 17 versions & 1 rubygems