I have a nested form, like: <% form_for @invoice do |f| %> <%= render :partial => "invoice_item_fields", :locals => {:f => f} %> <% end %> and _invoice_items_fields: <% f.fields_for :invoice_items do |builder| %> <%= link_to_remove_fields "remove", builder %> <%= builder.collection_select(:product_id, Product.all, :id, :name) %> <%= builder.text_field :quantity, :size => 4,%> <% end %> When i submit the form and it not pass the validations it render the new action again. The thing is the selected value for :product_id is no remembered, but the :quantity is ok. I read that i should setup an instance variable in the controller with the value of the selected option and then do something like: <%= builder.collection_select(:product_id, Product.all, :id, :name, :selected => @selected_product) %> but the thing is the application could have many :invoice_items, so i don''t know what to do for the select field "remember" the values. Thanks. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.