url_for([:edit, @post])
is working and generating /comments/123/edit. Now I need to add a query parameter, so that instead of
/comments/123/edit
You can pass params to url_for. Checkout it in the sourcecode: https://github.com/rails/rails/blob/d891c19066bba3a614a27a92d55968174738e755/actionpack/lib/action_dispatch/routing/route_set.rb#L675
params
url_for