Max Williams
2008-Mar-25 12:59 UTC
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---