Given the following:
<%= link_to "Add", group_request_path(gr), :confirm => "Are you sure?", :method=> :put, :remote => true %>
<%= link_to "Ignore", group_request_path(gr), :confirm => "Are you sure?", :method=> :put, :remote => true %>
How can I pass a decision param with either add or ignore in the link_to‘s above? Is there an option to add a URL param somehow with a link_to? I don’t want to have to use forms.
the
*_pathhelpers accept a hash of options to append to the path as a query string.In your example, assuming
group_request_path(gr)outputs something like/group_requests/123, you could add a query string with add/ignore actions like this:or
However this probably isn’t the correct way of going about this. It looks like you should probably have distinct actions in your controller, and routes specific to adding or ignoring. You’ll have to add something like the following to
config/routes.rb:Your links then become