Hi Fred,
Thanks for taking the trouble to respond again, especially since I
failed to follow your previous response. The problem then was that I
was unsuccessful in applying it or didn’t understand it … probable
both. I definitely failed to realize that the argument (object) was
to be omitted in the context of form elements. That “little detail”
seems missing in ActionView::Helpers::FormOptionsHelper. Someone
explicitly mentioned that in a subsequent post on this thread.
Sadly, when I followed your suggestion “to the letter”, I was
unsuccessful again. I’ve got:
====== Error Msg =========
NameError in Expenses#new
Showing app/views/expenses/new.html.erb where line #13 raised:
undefined local variable or method `vendor_id’ for #<ActionView::Base:
0x4822310>
Extracted source (around line #13):
10:
11: <%# New version of vendor selection -%>
12: <% @vendors = Vendor.find( :all, :order=>“nickname ASC”) -%>
13: <%= f.collection_select(vendor_id, @vendors, :id, :nickname)
%>
14: <%# End of New version -%>
[snip]
====== Error Msg =========
So I tested whether vendor_id would be defined if I created an Expense
instance in Rails console: Here’s what I got (edited for brevity):
K:_Projects\Ruby_Rails_Apps_EIMS\RTS>ruby script/console
Loading development environment (Rails 2.3.5)
expense = Expense.new
=> #<Expense id: nil, vendor: nil, description: nil, category: nil,
[snip]
expense.vendor_id [NoMethodError]
Expense.vendor_id [NoMethodError]
params[:vendor_id] [NameError]
I also tried using the symbol :vendor_id as the first arg. That
failed, too.
I apologize for being so obtuse. But I’d really like to get this app
working, and getting this expense-vendor hookup working may be my
last obstacle (for a while, anyway).
If you can give me a little more help about this problem, I’d be most
appreciative. If you need more info, I’d be happy to post portions
or all my code to a website from which you could download it for
inspection.
Best wishes,
Richard
On Jul 17, 5:29 am, Frederick C. [email protected]