Forum: Ruby on Rails Form creates multiple models - handling errors

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
psujohn (Guest)
on 2009-03-02 22:03
(Received via mailing list)
Ok I'm sure I could find the answer to this if I knew the correct
terminology but anyway ...

So I have a form to create a new vendor. A vendor has_many services
through services_vendors.

The new view has a couple "collection_select :service, i" and the
controller does:
@vendor.services_vendors << ServicesVendor.new()

which all works great unless you make an error filling out the form
and then you get sent back to the form where rails handily fills out
all the fields except for the services dropdowns.

Now from what I was reading I need an instance variable for the
service to "remember" it's setting but I'm not sure what to set, how
to set it or what to set it to.
This topic is locked and can not be replied to.