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...)

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Shandy Nantz
Sent: Friday, September 12, 2008 11:57 AM
To: [email protected]
Subject: [Rails] 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
--
Posted via http://www.ruby-forum.com/.



--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to