app/controllers/avo/actions_controller.rb in avo-3.0.0.pre13 vs app/controllers/avo/actions_controller.rb in avo-3.0.0.pre14

- old
+ new

@@ -18,37 +18,41 @@ @resource.hydrate(record: @record, view: @view, user: _current_user, params: params) @record = ActionModel.new @action.get_attributes_for_action end def handle + # puts ["action_params->", action_params].inspect resource_ids = action_params[:fields][:avo_resource_ids].split(",") @selected_query = action_params[:fields][:avo_selected_query] + # puts ["action_params[:fields]->", action_params[:fields]].inspect + fields = action_params[:fields].except(:avo_resource_ids, :avo_selected_query) + # puts ["fields->", fields.to_h].inspect args = { fields: fields, current_user: _current_user, resource: resource } - unless @action.standalone - args[:records] = if @selected_query.present? - @resource.model_class.find_by_sql decrypted_query - else - @resource.find_record resource_ids, params: params - end + args[:records] = if @selected_query.present? + @resource.model_class.find_by_sql decrypted_query + else + @resource.find_record resource_ids, params: params end + puts ["args->", args].inspect + performed_action = @action.handle_action(**args) respond performed_action.response end private def action_params - params.permit(:authenticity_token, :resource_name, :action_id, fields: {}) + params.permit(:authenticity_token, :resource_name, :action_id, :button, fields: {}) end def set_action @action = action_class.new( record: @record,