Class: Pragma::Operation::Index
- Inherits:
-
Base
- Object
- Base
- Pragma::Operation::Index
- Defined in:
- lib/pragma/operation/index.rb
Overview
Finds all records of the requested resource, authorizes them, paginates them and decorates them.
Instance Method Summary collapse
- #respond!(options) ⇒ Object
- #retrieve!(options) ⇒ Object
- #scope!(options, current_user:, model:) ⇒ Object
Instance Method Details
#respond!(options) ⇒ Object
27 28 29 30 31 |
# File 'lib/pragma/operation/index.rb', line 27 def respond!(, **) ['result.response'] = Response::Ok.new( entity: ['result.decorator.collection'] ) end |
#retrieve!(options) ⇒ Object
19 20 21 |
# File 'lib/pragma/operation/index.rb', line 19 def retrieve!() ['model'] = ['model.class'].all end |
#scope!(options, current_user:, model:) ⇒ Object
23 24 25 |
# File 'lib/pragma/operation/index.rb', line 23 def scope!(, current_user:, model:, **) ['model'] = ['policy.default.scope.class'].new(current_user, model).resolve end |