Sha256: c876106989d2ee9961ae966c3e5ba95cee4644e2d89db53ad7714a5fbd8764b3

Contents?: true

Size: 415 Bytes

Versions: 1

Compression:

Stored size: 415 Bytes

Contents

module Abilities
  module ActionController
    module Base
      extend ActiveSupport::Concern

      protected

      %w(can? cannot?).each do |name|
        define_method name do |action, subject|
          Abilities.send name, current_user, action, subject
        end
      end

      def authorize!(action, subject)
        raise Abilities::AccessDenied unless can? action, subject
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
abilities-0.1.1 lib/abilities/action_controller/base.rb