i was wondering how someone can pass hidden fields in a link_to performing a delete request. i have..
<%= link_to "delete", feed_item, method: :delete,
confirm: "You sure?",
title: feed_item.content,
user_id: user_id %>
<% end %>
ive been trying to pass user_id into my controller’s destroy action but it cant seem to find params[:user_id]
it seems like its possible to pass hidden values when the method is a :post, but how can i do so in a :delete?
i essentially just want the user_id in my destroy action, so it can redirect back to the users profile page.
thank you
The proper way would be to either put feed_item under user resource or user current_user method in the controller
if you decide to put it under user resource the modify your routes file as
and than in your link to delete change the path to
user_feed_item_path
Alternatively if you have current_user method from using any sort of authentication solution you can just use that in your redirect path