Sha256: 5ccdc2ea79649d167f617ccca1235c6987f5bfda4850be26f8ae451dc6a54dea

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 Bytes

Contents

# This overrides the before method provided by resource_controller so that the current_user is authorized
# for each action before proceding.
module ResourceController
  module Helpers
    module Internal
      protected
      # Calls the before block for the action, if one is present.
      #
      def before(action)
        resource = case action
        when :index, :new, :create
          model
        else object
        end

        authorize! action, resource
        invoke_callbacks *self.class.send(action).before
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_auth-0.30.2 app/controllers/resource_controller_decorator.rb
spree_auth-0.30.1 app/controllers/resource_controller_decorator.rb