Class: ApiMaker::IndexCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- ApiMaker::IndexCommand
- Defined in:
- app/services/api_maker/index_command.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
#api_maker_args, #collection, #collection_instance, #command, #command_response, #commands, #controller, #current_ability
Instance Method Summary collapse
Methods inherited from BaseCommand
command_error_message, each_command, execute_in_thread!, #execute_service_or_fail, #execute_with_response, #fail!, #fail_command_from_service_error_response, #failure_response, #failure_save_response, goldiloader?, #initialize, #inspect, #model_class, run_command, #save_models_or_fail, #serialize_service_errors, #succeed!
Constructor Details
This class inherits a constructor from ApiMaker::BaseCommand
Instance Method Details
#execute! ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/services/api_maker/index_command.rb', line 2 def execute! ApiMaker::Configuration.profile(-> { "IndexCommand: #{model_class.name}" }) do Rails.logger.debug { "API maker: IndexCommand execute: #{model_class.name} with Ransack: #{command.args&.dig(:q)&.permit!&.to_h}" } result = ApiMaker::CollectionLoader.execute!( ability: current_ability, api_maker_args: api_maker_args, collection: collection, locals: locals, params: command.args || {} ) succeed!(result) end end |