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 %>
--~--~---------~--~----~------------~-------~--~----~
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
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---