module PunditExtra::Helpers

Public Class Methods

included(base) click to toggle source
# File lib/pundit_extra/helpers.rb, line 3
def self.included(base)
  base.helper_method :can?, :cannot? if base.respond_to? :helper_method
end

Public Instance Methods

can?(action, resource) click to toggle source
# File lib/pundit_extra/helpers.rb, line 7
def can?(action, resource)
  policy(resource).send "#{action}?"
end
cannot?(*args) click to toggle source
# File lib/pundit_extra/helpers.rb, line 11
def cannot?(*args)
  !can?(*args)
end