# ActiveRecord introspection

**URL:** <https://www.ruby-forum.com/t/activerecord-introspection/104115>\
**Category:** Rails\
**Created:** [May 14, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/activerecord-introspection/104115 "2007-05-14T14:42:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 14, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/activerecord-introspection/104115/1 "2007-05-14T14:42:08Z")

</div>

Hi,

I have a reasonably complex AR object, that has\_many, contains foreign  
keys, and so on. How can I get the names of all the ‘attribute  
methods’? Getting the column names isn’t so difficult, but getting  
the associations seems to be trickier…

Thanks,  
Dave Welton

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 14, 2007, 3:39pm UTC](https://www.ruby-forum.com/t/activerecord-introspection/104115/2 "2007-05-14T15:39:18Z")

</div>

On May 14, 2007, at 2:40 PM, removed\_email\_address@domain.invalid wrote:

> I have a reasonably complex AR object, that has\_many, contains foreign  
> keys, and so on. How can I get the names of all the ‘attribute  
> methods’? Getting the column names isn’t so difficult, but getting  
> the associations seems to be trickier…

Take a look at the reflect\_on\_\* methods in the API.

– fxn
