Thanks for you additional guidance on my introduction of belongs_to,
> > Assuming Vendor belongs_to :expense then
> > f.collection_select :vendor_id, @vendors, :id, :name
> > would do the trick
> Au contraire: My concept is that every Expense belongs to some
> Vendor. However, every Vendor can have many different Expenses
> (incurred, as it were, at various times).
Sorry I worded that one back to front
No problem: I make so many mistakes that I amazed I get anything to
> That gave me:
> undefined method `merge' for :nickname:Symbol (referencing the
> collection_select line)
It's getting confused because ...
I coded a corrected (I hope) version in app\views\expenses
<%= f.label :vendor %><br />
<%# New version of vendor selection -%>
<% @vendors = Vendor.find( :all, :order=>"nickname ASC") -%>
<%= f.collection_select(:vendor, @vendors, :id, :nickname) %>
<%# End of New version -%>
<%= link_to 'New
Vendor', :controller=>'vendors', :action=>'new' %>
I got the following error msgs which I suspect are due to the fact
that I added one-to-many, etc after I already had a running version
that saved the vendor-name in the expense record.
ActiveRecord::AssociationTypeMismatch in ExpensesController#create
Vendor(#37938940) expected, got String(#21132310)
Expense Controller, expenses_controller.rb, lines 43-44 are:
@expense = K:\_Projects\Ruby\_Rails_Apps\_EIMS\RTS\app\controllers
Can you suggest how this should be coded in light of the vendor-
Thanks again in advance for any guidance you have time to offer.