About association

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?

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…

Please only ask questions in one spot (either railsforum.com or the
mailing list, not both)

Your question had already been answered here:

Ryan B.
Skype: radarlistener
MSN & Gtalk: [email protected]