URL "id" element not part of the params objects after submitting a form via form_tag

Why is the URL “id” element not part of the params objects after
submitting a form via form_tag?

Steps:

  1. Go to URL http://localhost:3000/users/delete?id=45
  2. Press Submit button
  3. Read id param in order to delete user, then redirect form

Delete Confirmation

<%= form_tag(‘/users/delete’) do %>
<%= submit_tag ‘Clique aqui para confirmar exclusão’ %>
<% end %>

def delete
if request.post?
if (!params[:id].nil?)
@user=User.find(params[:id])
@user.delete
end
redirect_to(:controller=>‘users’, :action => ‘list’)
end
end

When the form is posted, params[:id] does not exist, why?

Thanks

Am 05.07.2013 01:38, schrieb Rodrigo L.:

Why is the URL “id” element not part of the params objects after
submitting a form via form_tag?

You did not provide any context, which makes helping difficult.
I assume you are talking about Rails, since form_tag is not
part of Ruby, but there exists a form_tag helper in Rails.

Maybe you better post your question in a Rails mailing list.

Regards,
Marcus

Thanks. I will move it to rails list.