= link_to("Paint orange", Car.find_by(user_id: current_user.id,
acquaintance_id: user.id),
method: :patch,
remote: true, class: "btn btn-default")
This makes a link with href:
I'd like to add two url parameters to this link
http://localhost/cars/175?action=paint&color=orange
Is it possible?
You will need to use the explicit path generation, using car_path
:
= link_to("Paint orange", car_path(Car.find_by(user_id: current_user.id, acquaintance_id: user.id), task: "paint", color: "orange"), method: :patch, remote: true, class: "btn btn-default")
Note that I also replaced action
with task
. action
is reserved by Rails for the internal router, therefore you can't pass a parameter called action
or it will conflict with the router.