A
A
Anton2016-04-27 21:56:19
Ruby on Rails
Anton, 2016-04-27 21:56:19

How to submit a form from a custom action to ActiveAdmin?

Created two actions - first (get) and second (post).
I placed the "active_admin_form_for" form in the first template. The form is displayed. The field names are wrapped in first (for example: first[title]).
After clicking on the "submit" button, we get into the "second" action, in the body of which there is only one line: In the received JSON, we have nothing. That is, there are default form values, such as: "authenticity_token" or "controller" with "action", but no more. There are no fields. Why aren't there? The fields are non-standard. They are not in the table in the database. I just need to get the value from them in the "second" action for further manipulation (not for writing to the db).
render json: params

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2016-04-27
@hummingbird

Check that the attributes are specified in permit_params and, in general, it should be visible in the logs that the necessary attributes are present in the parameters during the POST action.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question