I'm working on a form that updates a product record and several associated detail records.

The detail records are showing and populating okay in the form. But when it hits the controller, I get Couldn't find Detail with ID=detail AND (details.product_id = 38). The :detail params seem to refer to the correct record id. Anyone have an idea how to fix this?

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])         [:detail].each {|id, attributes| @product.details.find(id).update_attributes(attributes)}       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 part of the view:

<% for @detail in @product.details %>   <%=text_field "detail", "remaining", :size=>4 %> <% end %>

Hi --

I almost bought the book the other day -- it looked really good. Now I'll definitely have to :slight_smile: