Class: ApplicationPolicy::Scope

Inherits:
Object
  • Object
show all
Defined in:
app/policies/application_policy.rb

Overview

Default access scope for querying records.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, scope) ⇒ Scope

Returns a new instance of Scope.


44
45
46
47
# File 'app/policies/application_policy.rb', line 44

def initialize(user, scope)
  @user = user
  @scope = scope
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope


42
43
44
# File 'app/policies/application_policy.rb', line 42

def scope
  @scope
end

#userObject (readonly)

Returns the value of attribute user


42
43
44
# File 'app/policies/application_policy.rb', line 42

def user
  @user
end

Instance Method Details

#resolveObject


49
50
51
# File 'app/policies/application_policy.rb', line 49

def resolve
  scope.all
end