module AccessGranted::Rails::ControllerMethods

Public Class Methods

included(base) click to toggle source
# File lib/access-granted/rails/controller_methods.rb, line 8
def self.included(base)
  base.helper_method :can?, :cannot?, :current_policy
end

Public Instance Methods

authorize!(*args) click to toggle source
# File lib/access-granted/rails/controller_methods.rb, line 20
def authorize!(*args)
  current_policy.authorize!(*args)
end
can?(*args) click to toggle source
# File lib/access-granted/rails/controller_methods.rb, line 12
def can?(*args)
  current_policy.can?(*args)
end
cannot?(*args) click to toggle source
# File lib/access-granted/rails/controller_methods.rb, line 16
def cannot?(*args)
  current_policy.cannot?(*args)
end
current_policy() click to toggle source
# File lib/access-granted/rails/controller_methods.rb, line 4
def current_policy
  @current_policy ||= ::Policy.new(current_user)
end