Hello-
I have a form that I'm using form_for on to bind the form to my order object. Within the form, I want to select a product (each order has one product, which makes this easy). In my order and product models, an order belongs_to a product. I didn't specify that a product has_many orders (although I did test that the problem still exists even if I do specify that). Here's the code I'm using to generate the select list:
@packages = Package.find(:all, :order => 'name') #this is in my controller
<%= f.collection_select :product, @products, :id, :name, { :prompt => '--select one--'} %>
The call to collection_select creates the list of options just fine, but if my order has a value set for product, it doesn't get set as the selected value.
I've tried a slew of other variations on the call to collection_select (e.g., using :product_id instead of :product) and all seem to fail.
Does anyone know what I might be doing wrong?
Regards, Eric