Class: ApplicationPolicy::Scope
- Inherits:
-
Object
- Object
- ApplicationPolicy::Scope
- Defined in:
- app/policies/application_policy.rb
Overview
Restricts ActiveRecord queries using scopes based on the user's access permissions
Instance Method Summary collapse
-
#initialize(organization_user, scope) ⇒ Scope
constructor
A new instance of Scope.
-
#resolve ⇒ ActiveRecord::Associations::CollectionProxy
The scope upon which to base ActiveRecord queries, restricted to records the organization user can access.
Constructor Details
#initialize(organization_user, scope) ⇒ Scope
Returns a new instance of Scope
75 76 77 78 |
# File 'app/policies/application_policy.rb', line 75 def initialize(organization_user, scope) @organization_user = organization_user @scope = scope end |
Instance Method Details
#resolve ⇒ ActiveRecord::Associations::CollectionProxy
Returns the scope upon which to base ActiveRecord queries, restricted to records the organization user can access
81 82 83 |
# File 'app/policies/application_policy.rb', line 81 def resolve scope end |