Populate f.select from database

I am fairly new to RoR and I have encountered something that I was
unable to figure out by searching google or the API resource

Basically I would like to populate a select drop down box on a form
with values that have been created on another model.

I am trying to make a form to “create a new order” and on that form
select a vendor that has already been populate from the vendor model

Can someone please help me come up with the code to make this drop
down box dynamically populated from the vendor table? I want the drop
down box to contain the vendor.name and also have the id each of the
vendors.

Any help in the right direction would be greatly appreciated.

On Oct 14, 6:50pm, David [email protected] wrote:

Can someone please help me come up with the code to make this drop
down box dynamically populated from the vendor table? I want the drop
down box to contain the vendor.name and also have the id each of the
vendors.

Any help in the right direction would be greatly appreciated.

See
http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html
or
http://guides.rubyonrails.org/form_helpers.html#making-select-boxes-with-ease

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs