# Reflecting on associations

**URL:** <https://www.ruby-forum.com/t/reflecting-on-associations/65140>\
**Category:** Rails\
**Created:** [August 16, 2006, 2:35pm UTC](https://www.ruby-forum.com/t/reflecting-on-associations/65140 "2006-08-16T14:35:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gareth\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@Gareth\_A](https://www.ruby-forum.com/u/Gareth_A)\
**Post date:** [August 16, 2006, 2:35pm UTC](https://www.ruby-forum.com/t/reflecting-on-associations/65140/1 "2006-08-16T14:35:08Z")

</div>

Is there an easy way to programatically work out the associations on a  
model?

If not, is there a positive reason it was omitted, or is it just  
something that  
hasn’t been implemented yet?

Thanks  
Gareth

---

<div class="post-metadata">

**Author:** ![Gareth\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@Gareth\_A](https://www.ruby-forum.com/u/Gareth_A)\
**Post date:** [August 16, 2006, 2:39pm UTC](https://www.ruby-forum.com/t/reflecting-on-associations/65140/2 "2006-08-16T14:39:11Z")

</div>

Gareth A. wrote:

> Is there an easy way to programatically work out the associations on a  
> model?
> 
> If not, is there a positive reason it was omitted, or is it just  
> something that  
> hasn’t been implemented yet?
> 
> Thanks  
> Gareth

This is something that I thought Dr. Nic was working on.

Dr. Nic?

---

<div class="post-metadata">

**Author:** ![Gareth\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@Gareth\_A](https://www.ruby-forum.com/u/Gareth_A)\
**Post date:** [August 16, 2006, 2:50pm UTC](https://www.ruby-forum.com/t/reflecting-on-associations/65140/3 "2006-08-16T14:50:09Z")

</div>

On 16 Aug 2006, at 13:33, Gareth A. wrote:

> Is there an easy way to programatically work out the associations  
> on a model?

Have you looked at ActiveRecord.reflections?  
[http://railsmanual.com/module/ActiveRecord%3A%3AReflection%3A%](http://railsmanual.com/module/ActiveRecord%3A%3AReflection%3A%25)  
3AClassMethods

---

<div class="post-metadata">

**Author:** ![Gareth\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b9bd4f/32.png) [@Gareth\_A](https://www.ruby-forum.com/u/Gareth_A)\
**Post date:** [August 16, 2006, 3:59pm UTC](https://www.ruby-forum.com/t/reflecting-on-associations/65140/4 "2006-08-16T15:59:25Z")

</div>

Jonathan del Strother \<maillist@…\> writes:

> On 16 Aug 2006, at 13:33, Gareth A. wrote:
> 
> > Is there an easy way to programatically work out the associations  
> > on a model?
> 
> Have you looked at ActiveRecord.reflections?  
> [http://railsmanual.com/module/ActiveRecord%3A%3AReflection%3A%](http://railsmanual.com/module/ActiveRecord%3A%3AReflection%3A%25)  
> 3AClassMethods

I have now - that’s exactly what I needed. Thank you 🙂

Gareth
