So I've seen that other people have been confused me about this, and I have read other answers but I'm still confused.
How is information stored and parsed into the params hash during a delete request? I understand how it works in regards to submitting information to it. i.e. when a Put, Post or Get request is issued, I understand that the info is passed via params hash to respective controller action.
However, based on the code below in the user partial (_user.html.erb) :
<li>
<%= gravatar_for user, size: 52 %>
<%= link_to user.name, user %>
<% if current_user.admin? && !current_user?(user) %>
<%= link_to "delete", user, method: delete,
data: {confirm: "You sure?"} %>
<% end %>
</li>
And the code in the DESTROY action that is automatically routed to:
def destroy
User.find(params[:id]).destroy
flash[:success] = "User destroyed."
redirect_to users_url
end
I don't understand how the params hash gets the user id stored in it. I'd understand if it were params[:user][:id] since we are posting the user which has its list of attributes. But, I don't get how the id gets stored DIRECTLY into the params hash. This has been bothering me for a while so please any insight would be appreciated.