Sha256: d5978d94791a1ff0add3f3caf760f07bfc04329dd95df8b2cd50a45f20a07d96

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

#
# Authorization methods for CanCanCan
# https://github.com/CanCanCommunity/cancancan
#
module ActiveManageable
  module Authorization
    module CanCanCan
      extend ActiveSupport::Concern

      private

      def authorize(record:, action: nil)
        action ||= @current_method
        current_ability.authorize!(action, record)
      end

      def authorization_scope
        model_class.accessible_by(current_ability)
      end

      def current_ability
        ::Ability.new(current_user)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_manageable-0.2.0 lib/active_manageable/authorization/cancancan.rb