Hello all, I am a newbie in Rails and have been trying to solve the following by myself for the past 3 days to no avail. Any help is appreciated. Here is what I am trying to do: 1. Run a search on a table 2. Create a form that will update one attribute per record within the result set Here is the code: <% @search_result.each do |result| %> <% form_for "result" do |f| %> <tr> <td><%= f.hidden_field :product_id, :value => result.id%> </ td> <td><%= result.product_id %></td> <td><%= result.merchant_id %></td> <td><%= result.price_am %></td> <td><%= f.check_box(result.cool_ind, options = {}, checked_value true, unchecked_value = false)%></td> <td align="center"><%= link_to "update", :controller => ''search'', :action => ''update'' %></td> </tr> <% end %><% end %> However, this is not working at all. The view renders fine. But I am not sure why the id that is passed to the controller is totally out of whack. I have tried the following hash in the controller and it gives me an error that this is nil params[:product][:id] In addition, it is complaining about the checkbox (i.e. false method passed) Could any of you tell me what hash to use in the controller? Thanks in advance --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe a stupid remark: I don''t see any submit button in your form...> However, this is not working at all. The view renders fine. But I am > not sure why the id that is passed to the controller is totally out of > whack. I have tried the following hash in the controller and it gives > me an error that this is nil params[:product][:id]You should have a look at the server'' logs. Find out something like: Parameters: {...} to understand what is sent to the controller. Jej> > In addition, it is complaining about the checkbox (i.e. false method > passed) > > Could any of you tell me what hash to use in the controller? > > Thanks in advance--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Probably nothing to do with your problem but html does not allow <form> between <table> and <tr> though some browsers do not object. It is not allowed between <tr> and <td> either. 2009/2/6 Jej <jejc-GANU6spQydw@public.gmane.org>> > > > Maybe a stupid remark: I don''t see any submit button in your form... > > > > However, this is not working at all. The view renders fine. But I am > > not sure why the id that is passed to the controller is totally out of > > whack. I have tried the following hash in the controller and it gives > > me an error that this is nil params[:product][:id] > > You should have a look at the server'' logs. Find out something like: > Parameters: {...} to understand what is sent to the controller. > > Jej > > > > > > In addition, it is complaining about the checkbox (i.e. false method > > passed) > > > > Could any of you tell me what hash to use in the controller? > > > > Thanks in advance > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---