multi polymorphic relationship?

In my app, I want to let users mark various relationship between them
and other users and objects. Example

john selects mary as favorite user
john selects mary as featured user of the month
john puts mary in bookmarks
john selects "funny cat" as favorite picture
john votes for "funny cat" as featured picture of the month
john puts "funny cat" in bookmarks

I could have a bookmark model, a favorite model, and a feature model
and use polymorphic association. But this seems like a lot of
duplication.

acts_as_favorable
acts_as_bookmarkable
acts_as_featureable

I really just want to say something like

acts_as_markable :models => [:favorite,:bookmark,:feature]

u=User.find_ny_name('john')
p=Picture.find 10
u.mark_favorite( p)
u.mark_feature( p)
u2 = User.find_by_name('mary')
u.mark_bookmark( u2)
u.marked_bookmark?( u2) # true
u.marked_favorite_users # list of favorite users

Suggestions?

rubynuby wrote:

In my app, I want to let users mark various relationship between them
and other users and objects.

I could have a bookmark model, a favorite model, and a feature model
and use polymorphic association. But this seems like a lot of
duplication.

acts_as_favorable
acts_as_bookmarkable
acts_as_featureable

I really just want to say something like

acts_as_markable :models => [:favorite,:bookmark,:feature]

What you want is the wonderful has_many_polymorphs => http://blog.evanweaver.com/files/doc/fauna/has_many_polymorphs/files/README.html

- Niels.

Thanks, I read the doc several times but I still don't get how I can
use it in my case. It seems I still need a separate join model for
favorite, bookmark, etc. ??

You may be able to use a combination of Single Table Inheritance and
polymorphic associations. STI would handle distinguishing bookmarks
from favorites from features, etc while allowing them all to share the
'mark' behavior. Polymporphic associations, as I think you already
understood, would allow you to 'mark' an object of any type.