Help with Forms

frank95a
Fri, 06 Feb 2009 17:20:55 -0000

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| %>

<%= f.hidden_field :product_id, :value =>
result.id%> </
td>
<%= result.product_id %>
<%= result.merchant_id %>
<%= result.price_am %>
<%= f.check_box(result.cool_ind, options = {}, checked_value true,
unchecked_value = false)%>


<%= link_to "update",
:controller =>
''search'', :action => ''update''
%>





        <% 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