# Association lookup?

**URL:** <https://www.ruby-forum.com/t/association-lookup/129131>\
**Category:** Rails\
**Created:** [February 14, 2008, 6:21pm UTC](https://www.ruby-forum.com/t/association-lookup/129131 "2008-02-14T18:21:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [February 14, 2008, 6:21pm UTC](https://www.ruby-forum.com/t/association-lookup/129131/1 "2008-02-14T18:21:17Z")

</div>

I feel like this might be a very simple problem and something just  
isn’t catching my eye in the API.

I’m writing a sort of verification form that allows you to add  
individual fields to verify single attributes from the original form.  
Each attribute has search conditions associated with it based on its  
type, and I need to lookup what kind of classes the object from the  
form ‘has\_many’ and ‘belongs\_to’ has.

I imagine there’s something as simple as:

Blog.has\_many\_associations  
=\> [‘users’, ‘posts’]  
Post.belongs\_to\_associations  
=\> [‘user’, ‘comment’, ‘blog’]

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [February 14, 2008, 6:44pm UTC](https://www.ruby-forum.com/t/association-lookup/129131/2 "2008-02-14T18:44:49Z")

</div>

Found my answer here:  
[http://gilesbowkett.blogspot.com/2007/12/activerecordbasereflectonallassociation.html](http://gilesbowkett.blogspot.com/2007/12/activerecordbasereflectonallassociation.html)
