Pull from two tables to populate a select

I need to populoate a drop-down with values from two tables. Currently I
have this code which just pulls from one table:

<%= select( “hotelmembership”, “hotel_id”, Hotel.find( :all, :order=>
‘name’ ).collect {|h| [h.name, h.id]}, { :include_blank => FALSE } ) %>

Now I need to pull more data to add to this drop-down, but I am unsure
of how to do this. Any suggestions?, Thanks,

-S

When you say you need more data–do you mean you’ve got another table
w/rows that should get appended on to bottom of the list your present
code produces? Or do you mean you want to e.g., concatenate some
additional fields from another table onto each hotel’s name?

(Either way, consider moving your .find call to the controller &
populating a variable to reference from your view, so as to keep the
view nice & clean looking…)

Why don’t you collect all the data you need in an array or hash and
once you are finished, populate the select?

On Sep 12, 8:57 pm, Shandy N. [email protected]

I have the same question as the other two, what additional information
are you trying to add to this drop-down?

On Sep 12, 1:57 pm, Shandy N. [email protected]