# Relating models question

**URL:** <https://www.ruby-forum.com/t/relating-models-question/127662>\
**Category:** Rails\
**Created:** [January 31, 2008, 5:44am UTC](https://www.ruby-forum.com/t/relating-models-question/127662 "2008-01-31T05:44:41Z")\
**Posts on this page:** 1\
**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:** [January 31, 2008, 5:44am UTC](https://www.ruby-forum.com/t/relating-models-question/127662/1 "2008-01-31T05:44:41Z")

</div>

Hello All,

Basically I’m trying to create a model relationship that is used to  
link (I’m hoping to call it Follows) one model to another. I was  
hoping to use a polymorphic relationship so I don’t have lots of  
tables. A structure like below is what I’m shooting for.

User.follows.[Model]

Where Model is any model that can be followed. I’ve tried a bunch  
of :though, polymofic senerios, but just can’t seem to get it to work  
as desired.

I would like a User to Follow any other model. Seems like this should  
be easy to do in ActiveRecord.

u = User.find(1)

c = Category.find(1)

u.follows \<\< c

then

u.follows.categories would give me all the categories a user follows.

Anyone come out there tackle something like this ?

Thanks
