Sha256: 74bdac974c8e2a2a22ad3a46630b880fb2082114ec38e7d264cf8bd31beadd14
Contents?: true
Size: 813 Bytes
Versions: 6
Compression:
Stored size: 813 Bytes
Contents
Spree::Admin::BaseController.class_eval do # 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
Version data entries
6 entries across 6 versions & 2 rubygems