So, I saw that other people embarrassed me, and I read other answers, but I'm still confused.
How is information stored in the params hash stored and parsed during a delete request? I understand how this works in relation to providing him with information. that is, when a Put, Post or Get request is issued, I understand that the information is transmitted through the hash of the params hash to the corresponding controller action.
However, based on the code below in 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 action is DESTROY, which automatically redirects to:
def destroy User.find(params[:id]).destroy flash[:success] = "User destroyed." redirect_to users_url end
I do not understand how the params hash gets the user id stored in it. I would understand if these were params [: user] [: id], since we are sending a user who has his own list of attributes. But I do not understand how the identifier is stored DIRECTLY in params hashes. It bothered me for a while, so please, any understanding will be appreciated.
source share