Sunday, June 27, 2010

[Rails] How to populate a table with id of selected item from another table

Hi,

I have a "New Expense" form that includes a select field named vendor
that provides a a drop-down list of all vendors.

When a user makes a selection of a vendor-name, that name populates
the vendor field of the new Expense record. I'm happy with the drop-
down list of names, but I'd rather populate the Expense record with
the ID of the vendor.

IMHO, this is a common database problem. Can you point me to a
simple example on the Web for handling this. I've found plenty of
HABTM examples with check-boxes, but none (so far) exactly on point.

Thanks in Advance,
Richard

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate