Answer the question
In order to leave comments, you need to log in
How to pass array of linked table id through form in Rails?
The Route model is connected to the Address model, via AdressesRoute, many-to-many.
You need to file a form for routes/new so that you can select the start and end address from two drop-down lists.
Should I specify address_ids or adresses_route_ids in route_params?
Tried params.require(:route).permit(:address_ids)
through collection_select gets one value from the drop-down list
if params.require(:route).permit( { address_ids: [] }), nothing gets into the hash at all.
With checkboxes, it turned out to write several id to address_ids, in the controller it was: params.require(:route).permit( { address_ids: [] }), and in the form collection_check_box {multiple: true}.
I don't understand how to add from two collections...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question