Class: Wallaby::ActiveRecord::PunditProvider

Inherits:
PunditAuthorizationProvider
  • Object
show all
Defined in:
lib/adapters/wallaby/active_record/pundit_provider.rb

Overview

Pundit provider for Wallaby::ActiveRecord

Instance Method Summary collapse

Instance Method Details

#accessible_for(_action, scope) ⇒ Object

Filter a scope

Parameters:

  • _action (Symbol, String)
  • scope (Object)

Returns:

  • (Object)


11
12
13
14
15
16
# File 'lib/adapters/wallaby/active_record/pundit_provider.rb', line 11

def accessible_for(_action, scope)
  Pundit.policy_scope! user, scope
rescue Pundit::NotDefinedError
  Logger.warn "Cannot find scope policy for `#{scope}`."
  scope
end