# Has\_many\_polymorphs - specifying the names of the 'children'

**URL:** <https://www.ruby-forum.com/t/has-many-polymorphs-specifying-the-names-of-the-children/132870>\
**Category:** Rails\
**Created:** [March 25, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/has-many-polymorphs-specifying-the-names-of-the-children/132870 "2008-03-25T13:59:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [March 25, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/has-many-polymorphs-specifying-the-names-of-the-children/132870/1 "2008-03-25T13:59:40Z")

</div>

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
