I am building a blog, an event has many comments and a comment belong to an event. But each comment I created under different events all got different id. For example, if I can access url: http://localhost:3000/event/1/comments/1, then I cannot have access http://localhost:3000/event/2/comments/1. Because the first comment created under event2 had id 2. How to fix that? -- 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 -~----------~----~----~----~------~----~------~--~---
Don''t understand your problem. The id is an autoincrement field and of course each comment gets it''s own id. The association is (or should be) defined by the events_id field in the comments table. Please provide your code how you''ve defined the association in the model and how you create the new comments in the controller... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Please only ask questions in one spot (either railsforum.com or the mailing list, not both) Your question had already been answered here: http://railsforum.com/viewtopic.php?pid=75146#p75146 ----- Ryan Bigg Freelancer Skype: radarlistener MSN & Gtalk: radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org On 16/09/2008, at 4:41 PM, Samsung Action wrote:> > I am building a blog, an event has many comments and a comment > belong to > an event. > But each comment I created under different events all got different > id. > For example, if I can access url: > http://localhost:3000/event/1/comments/1, then I cannot have access > http://localhost:3000/event/2/comments/1. Because the first comment > created under event2 had id 2. > How to fix that? > -- > 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 -~----------~----~----~----~------~----~------~--~---