Open tamersalama opened 15 years ago
Posted on StackOverflow as well - http://stackoverflow.com/questions/983225/multiple-hasmanypolymorphs-in-one-model
best bet is to make a failing test and fix it yourself; this project is in patch-accepting-mode only :-/
I'm trying to define multiple polymorphic relations (
has_many_polymorphs plugin
) from a single parent to same children.Note has many viewers Note has many editors Viewers could be either Users or Groups Editors could be either Users or Groups Permission is the association model with
note_id
,viewer_id
,viewer_type
,editor_id
,editor_type
fieldsEverything works out as expect as long as I have only one has_many_polymorphs relation defined in Note model
Now, problems start to appear when I add the second relation
I've tried refining the definition of
has_many_polymorphs
but it didn't work. Not even with an STI model forViewPermission < Permission
, andEditPermission < Permission
.Any thoughts / workarounds / issue pointers are appreciated.
Rails 2.3.0