# Params\[:id\] not working

**URL:** <https://www.ruby-forum.com/t/params-id-not-working/183336>\
**Category:** Rails\
**Created:** [February 12, 2010, 12:48am UTC](https://www.ruby-forum.com/t/params-id-not-working/183336 "2010-02-12T00:48:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [February 12, 2010, 12:48am UTC](https://www.ruby-forum.com/t/params-id-not-working/183336/1 "2010-02-12T00:48:43Z")

</div>

Hey all,

I have two problems with this code. First, regardless of what option I  
select from the dropdown menu, it only updates the record with id 1, and  
second even if I just refresh the page, it still updates the record of  
id 1.  
I basically just want to update the record that the user picks from  
dropdown  
menu. But params[:id] is not doing the trick:

User Requests Controller:

# def confirm x = current\_user.contact.contactable @user\_requests = UserRequest.find(:all, :conditions =\> ["location\_id

?", x])  
if @user\_request = UserRequest.find(params[:id])  
update\_confirm  
end  
end

def update\_confirm  
@user\_request.creator\_id = current\_user.contact.contactable  
@user\_request.save  
end  
end

confirm.erb form:  
\<% form\_for(:user\_request, :url =\> {:action =\> :confirm}) do %\>  
Request: \<%= select\_tag(:id,  
options\_from\_collection\_for\_select(@user\_requests, :id,  
:request\_status\_id))  
%\>   
  
Password: \<%= password\_field\_tag :password %\>   
  
\<%= submit\_tag ‘Confirm Request’ %\>  
\<% end %\>

routes:  
map.resources :user\_requests, :member =\> {:confirm =\> :any}

For this part right here: if @user\_request =  
UserRequest.find(params[:id])  
I would like to say something along the lines of if you have selected an  
option from the dropdown menu, then we capture it before updating.  
Any suggestions? Thanks.

–  
View this message in context:  
[http://old.nabble.com/params-%3Aid--not-working-tp27556740p27556740.html](http://old.nabble.com/params-%3Aid--not-working-tp27556740p27556740.html)  
Sent from the RubyOnRails Users mailing list archive at [Nabble.com](http://Nabble.com).
