Forum: Ruby on Rails Database table name in array?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fresh M. (Guest)
on 2009-01-30 19:28
Is it possible to do something like this?

tables = Array[ "Xxx", "Yyy", "Zzz"]

for table in tables
  results = table.find(:all, :conditions => [".....
end
Colin L. (Guest)
on 2009-01-30 19:32
(Received via mailing list)
I would try it and see. It will either work or not.

2009/1/30 James B. <removed_email_address@domain.invalid>
Ar C. (Guest)
on 2009-01-30 20:24
James B. wrote:
> Is it possible to do something like this?
>
> tables = Array[ "Xxx", "Yyy", "Zzz"]
>
> for table in tables
    @records = table.camelcase.constantize.find(:all, blah blah blah)
> end
This topic is locked and can not be replied to.