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