Class: Avo::ActionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Avo::ActionsController
- Defined in:
- app/controllers/avo/actions_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#_current_user, #check_avo_license, #context, #exception_logger, #init_app, #render, #turbo_frame_request?
Methods included from Concerns::Breadcrumbs
#add_breadcrumb, #avo_breadcrumbs
Methods included from UrlHelpers
#edit_resource_path, #new_resource_path, #related_resources_path, #resource_attach_path, #resource_detach_path, #resource_path, #resource_view_path, #resources_path
Methods included from ApplicationHelper
#a_button, #a_link, #button_classes, #empty_state, #get_model_class, #input_classes, #render_license_warning, #render_license_warnings, #root_path_without_url, #svg, #white_panel_classes
Instance Method Details
#handle ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/avo/actions_controller.rb', line 22 def handle resource_ids = action_params[:fields][:avo_resource_ids].split(",") @selected_query = action_params[:fields][:avo_selected_query] fields = action_params[:fields].except(:avo_resource_ids, :avo_selected_query) args = { fields: fields, current_user: _current_user, resource: resource } unless @action.standalone args[:models] = if @selected_query.present? @resource.model_class.find_by_sql decrypted_query else @resource.find_record resource_ids, params: params end end performed_action = @action.handle_action(**args) respond performed_action.response end |
#show ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/controllers/avo/actions_controller.rb', line 14 def show # Se the view to :new so the default value gets prefilled @view = :new @resource.hydrate(model: @model, view: @view, user: _current_user, params: params) @model = ActionModel.new @action.get_attributes_for_action end |