I have a group of classes that I associate to a Note class through a
has_many :through polymorphic association, which works great! However,
noticed that I have a good amount of duplicate functionality within
classes for the Note interface. I would like to move this functionality
well as the actual has_many :through and join table associations into
common file in order to adhere to the DRY principle.
I tried to make my classes inherit from a NoteInterface class that
the associations, but the association would use the parent class
(NoteInterface) as the type in the join table. I already had to use
set_table() to get AR to use the name of the child class for the table.
there a similar way to override the name of the type a polymorphic
association will use?
I also tried putting the associations in a module and use it as a mixin,
when ruby parses the file, it doesn’t know what to do with them.
Has anyone else tried to do this? Is this even be possible?