Hi. I have an app that has prodcts, which have many details.
I'm writing a view that allows the user to update the product info and also info on each details record (number remaining in inventory, etc). The form displays fine and populates w/ the detail records, and it updates the product record. But it does not alter the detail record at all. Suggestions?
Here's the controller...
def edit if request.get? @product = Product.find(params[:id], :order=>'gender, size', :include=>'details' )
else @product = product.find(params[:id]) if @product.update_attributes(params[:product]) flash[:notice] = 'product was successfully updated.' redirect_to :action => 'show', :id => @product else render :action => 'edit' end end end
And a snippet of the view
<% for @detail in @product.details %>
<td><%= text_field ("detail", "remaining") %></td> <% end %>