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

<p>Delete Confirmation</p>

<%= form_tag('/users/delete') do %>
    <%= submit_tag 'Click here to delete this user' %>
<% end %>

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

    end
end


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

Thanks

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/091b1ca83a69eed98630de550e88d2a0%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to