Hi all,
I have two types of models which I’m not sure how to model (or if it’s
even
feasible) with ActiveRecord. Let me know if you’ve got any good ideas.
-
For those of you who are familliar with del.icio.us, you probably
know
that you can bookmark a site, and add your own tags to it. Each person
has
their own tags for a site, even though multiple people can bookmark a
site.
How would you create that relationship in ActiveRecord?
user has many websites (easy)
BUT… there’s no relation between tags and websites, or users and
tags.
It’s like a 3-way user-tag-website relationship. “Every user-website
pair
has many tags”. How do you model that one? Easy enough to do in a
relational db, but I can’t get my head around it with Active Record. -
This one may be easier, but I still can’t get it… kinda similar to
#1.
Let’s say a user can bookmark a website, and can also “rank” that
website.
Unlike the example above, all I really want to do is assign an attribute
to
the user-website relationship (ie add a field to the users_websites
table)
“every user-website pair has one rank”. Again - is this one possible?
Many thanks for any advice you can give. I know these relationships are
somewhat complext, just wondering how far I can take ActiveRecord before
dropping into straight SQL.
Thanks!
Tom