From: Ravi Dtv Date: 2010-05-19T21:24:07+09:00 Subject: Re: passing values from partial to controller Gregor Panek wrote: > yeah that's because you pass only one parameter to the hidden_field_tag > so you got this: > > > and your value is still nil, so you have to pass a second parameter to > the hidden_field_tag to set the value: > > <%=hidden_field_tag :group_name, "yourgroupname"%> > then you got this in html > > > now you should get with params[:group_name] the value that you set > > hope this works :) Thanks Gregor Panek. I am able to pass the values but plz check my action in the controller. RuntimeError in UsersController#addfriendtogroups Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id Request Parameters: {"group_name"=>"testinggroup2", "commit"=>"Add to group", "authenticity_token"=>"MHB8Ys8vccsGwbgnsb9r5T68oqirPpW6YUscfDojZhY=", "id"=>"testing", "user"=>{"login"=>"santosh"}} I need to get the id from login( santosh) and id from Group (testinggroup2) and insert the both ids into another table. Please help. Thank you. def addfriendtogroups @f=User.find_by_login(params[:login]).id @g=Group.find_by_group_name(params[:group_name]).id @addfriend=GroupFriend.create(:user_id => current_user.id , :group_id => @g,:friend_id => @f) respond_to do |format| if @addfriend.save flash[:notice] = "Friend added to group successfully." format.html {redirect_to :back} end end end -- Posted via http://www.ruby-forum.com/.