On Oct 16, 8:30 am, Bob Sanders
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> I''m trying to find the best way to associate notes to many models.
I
> have a table called notes, and the tables I wanted associated to those
> notes are:
>
> players
> teams
> parents
>
> To accomplish it, would my notes database column just have the
> following:
>
> Note
> ---------
> body:string
> player_id:integer
> team_id:integer
> parent_id:integer
>
> That does seem messy, so I don''t know if that''s correct.
Is there a
> better approach to associate notes to many models?
> --
> Posted viahttp://www.ruby-forum.com/.
Does a note need to be associated with only one of the 3 tables for
each instance? If yes, take a look at has_many_polymorphs.
http://m.onkey.org/2007/8/14/excuse-me-wtf-is-polymorphs
http://blog.evanweaver.com/files/doc/fauna/has_many_polymorphs/files/README.html
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---