Sha256: 654d6f6fe9a97e989a090f25b34f1f0e8f6d481469c5cf3f5af21799c8133e2a

Contents?: true

Size: 442 Bytes

Versions: 1

Compression:

Stored size: 442 Bytes

Contents

module AccessGranted
  module ControllerMethods
    def current_policy
      @current_policy ||= ::Policy.new(current_user)
    end

    def self.included(base)
      base.helper_method :can?, :cannot?, :current_policy
    end

    def can?(*args)
      current_policy.can?(*args)
    end

    def cannot?(*args)
      current_policy.cannot?(*args)
    end

    def authorize!(*args)
      current_policy.authorize!(*args)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
access-granted-0.1.0 lib/access-granted/controller_methods.rb