# Database table name in array?

**URL:** <https://www.ruby-forum.com/t/database-table-name-in-array/159039>\
**Category:** Rails\
**Created:** [January 30, 2009, 6:28pm UTC](https://www.ruby-forum.com/t/database-table-name-in-array/159039 "2009-01-30T18:28:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@giga](https://www.ruby-forum.com/u/giga)\
**Post date:** [January 30, 2009, 6:28pm UTC](https://www.ruby-forum.com/t/database-table-name-in-array/159039/1 "2009-01-30T18:28:09Z")

</div>

Is it possible to do something like this?

tables = Array[“Xxx”, “Yyy”, “Zzz”]

for table in tables  
results = table.find(:all, :conditions =\> ["…  
end

---

<div class="post-metadata">

**Author:** ![giga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@giga](https://www.ruby-forum.com/u/giga)\
**Post date:** [January 30, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/database-table-name-in-array/159039/2 "2009-01-30T18:32:03Z")

</div>

I would try it and see. It will either work or not.

2009/1/30 James B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![giga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@giga](https://www.ruby-forum.com/u/giga)\
**Post date:** [January 30, 2009, 7:24pm UTC](https://www.ruby-forum.com/t/database-table-name-in-array/159039/3 "2009-01-30T19:24:01Z")

</div>

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
