Has_many_polymorphs - specifying the names of the 'children'

I have a class called MusicService which can have various things
‘shared’ with it, so i’m setting up a has_many_polymorphs like this:

has_many_polymorphs :shared_content, :from => [:resources, :lessons,
:courses], :through => :sharings

However, this will generate some associations like this:

@music_service.resources
=> resources shared with that music service.

However, i don’t want that association as it already exists and has a
different meaning (‘resources created by that music service’). So, i
want the polymorphic associations to be called

@music_service.shared_resources
@music_service.shared_lessons
@music_service.shared_courses

Similarly, i want to refer to the music services that have been linked
through sharings as ‘allowed_music_services’, so

@resource.allowed_music_services
@course.allowed_music_services
@lesson.allowed_music_services

I’m sure this is simple but i can’t work it out, can anyone help please?

thanks
max

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs