app/controllers/avo/actions_controller.rb in avo-2.16.1.pre.1.nativefields vs app/controllers/avo/actions_controller.rb in avo-2.17.0
- old
+ new
@@ -46,12 +46,20 @@
def action_params
params.permit(:authenticity_token, :resource_name, :action_id, fields: {})
end
def set_action
- action_class = params[:action_id].gsub("avo_actions_", "").camelize.safe_constantize
-
@action = action_class.new(model: @model, resource: @resource, user: _current_user, view: :edit)
+ end
+
+ def action_class
+ klass_name = params[:action_id].gsub("avo_actions_", "").camelize
+
+ valid_klass = Avo::BaseAction.descendants.find do |action|
+ action.to_s == klass_name
+ end
+
+ valid_klass
end
def respond(response)
response[:type] ||= :reload
messages = get_messages response