Module: Calib::Pundit::ControllerNestable

Extended by:
ActiveSupport::Concern
Defined in:
lib/calib/pundit/controller_nestable.rb

Overview

Defined Under Namespace

Classes: Scope

Instance Method Summary collapse

Instance Method Details

#initialize(user, record) ⇒ Object



13
14
15
16
# File 'lib/calib/pundit/controller_nestable.rb', line 13

def initialize(user, record)
  @user = user
  @record = record.is_a?(Array) ? record.last : record
end

#scopeObject



18
19
20
# File 'lib/calib/pundit/controller_nestable.rb', line 18

def scope
  Pundit.policy_scope! user, self.class.namespace + [record.class]
end