# Getting table field names from an object

**URL:** <https://www.ruby-forum.com/t/getting-table-field-names-from-an-object/121409>\
**Category:** Rails\
**Created:** [November 27, 2007, 7:13pm UTC](https://www.ruby-forum.com/t/getting-table-field-names-from-an-object/121409 "2007-11-27T19:13:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinevans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f475e1/32.png) [@martinevans](https://www.ruby-forum.com/u/martinevans)\
**Post date:** [November 27, 2007, 7:13pm UTC](https://www.ruby-forum.com/t/getting-table-field-names-from-an-object/121409/1 "2007-11-27T19:13:24Z")

</div>

If I had the following

@recipes = recipe.find\_all  
Is there a way to find all the field names returned by the query and the  
data in them.  
Thanks  
Martin

---

<div class="post-metadata">

**Author:** ![martinevans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f475e1/32.png) [@martinevans](https://www.ruby-forum.com/u/martinevans)\
**Post date:** [November 27, 2007, 7:54pm UTC](https://www.ruby-forum.com/t/getting-table-field-names-from-an-object/121409/2 "2007-11-27T19:54:50Z")

</div>

Recipe.column\_names returns an array of all of the columns.

-Bill

Martin E. wrote:

> If I had the following
> 
> @recipes = recipe.find\_all  
> Is there a way to find all the field names returned by the query and the  
> data in them.  
> Thanks  
> Martin

–  
Sincerely,

William P.

---

<div class="post-metadata">

**Author:** ![martinevans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f475e1/32.png) [@martinevans](https://www.ruby-forum.com/u/martinevans)\
**Post date:** [November 30, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/getting-table-field-names-from-an-object/121409/3 "2007-11-30T16:38:34Z")

</div>

What if @recipes was gotten with a mySQL JOIN statement?
