Class: Avo::ActionsController
Instance Method Summary
collapse
#exception_logger, #init_app
Instance Method Details
#handle ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/avo/actions_controller.rb', line 22
def handle
models = resource_model.find action_params[:resource_ids]
avo_action = action_params[:action_class].safe_constantize.new
avo_action.handle_action(request, models, action_params[:fields])
render json: {
success: true,
response: avo_action.response,
}
end
|
#index ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/avo/actions_controller.rb', line 5
def index
avo_actions = avo_resource.get_actions
actions = []
if params[:resource_id].present?
model = resource_model.find params[:resource_id]
end
avo_actions.each do |action|
actions.push(action.new.render_response model, avo_resource)
end
render json: {
actions: actions,
}
end
|