Hello. For fun, I''m making a text based web MMO. I have the following tables to consider. characters quests objectives So right now my quests can have many objectives (ie: kill 10 wolves, kill pack leader). So that''s easy enough. But many characters can have the same quests. So I made characters_quests Ok that''s fine. But since quests have multiple objectives that I need to track how do I do this? characters_quests_objectives ? I don''t know why but I can''t wrap my head around this relationship right now. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I think this is the relationship model? character has_and_belongs_to_many quests character has_many objectives, :through => quests quest has_and_belongs_to_many characters quest has_many objectives On Aug 26, 10:20 am, Jooma __ <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hello. > > For fun, I''m making a text based web MMO. > > I have the following tables to consider. > > characters > quests > objectives > > So right now my quests can have many objectives (ie: kill 10 wolves, > kill pack leader). > > So that''s easy enough. > But many characters can have the same quests. So I made > > characters_quests > > Ok that''s fine. But since quests have multiple objectives that I need to > track how do I do this? > > characters_quests_objectives ? > > I don''t know why but I can''t wrap my head around this relationship > right now. > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
TomRossi7 wrote:> I think this is the relationship model? > > character has_and_belongs_to_many quests > character has_many objectives, :through => quests > > quest has_and_belongs_to_many characters > quest has_many objectivesI think I have to make a separate table. tracked_objectives which belongs to character through quests. As multiple people can do the same quests and will be at different steps at different times, they''ll need the same objectives but at different counts. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
It sounds like you should avoid has_and_belongs_to_many since you are tracking attributes of the join relationship. Maybe something like this: character has_many objective_assignments character has_many objectives, :through => objective_assignments character has_many quest_assignments character has_many quests, :through => objective_assignments Does that seem right? On Thu, Aug 26, 2010 at 12:26 PM, Jooma __ <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> TomRossi7 wrote: > > I think this is the relationship model? > > > > character has_and_belongs_to_many quests > > character has_many objectives, :through => quests > > > > quest has_and_belongs_to_many characters > > quest has_many objectives > > I think I have to make a separate table. tracked_objectives which > belongs to character through quests. > > As multiple people can do the same quests and will be at different steps > at different times, they''ll need the same objectives but at different > counts. > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.