newbie question on activerecord

I am an new to Rails. I created a simple web app called test and database called test with 'People' table. Then I did scaffold of Person and everything is fine. I was able to go to the index page and from there I was able to create a new person. After creating it went back to index and from there I clicked the 'edit' and I got activerecord::recordnotfound I didn't make any changes to the default code generated for me.

Could someone tell me what could be wrong?

Thanks.

take a look at the edit method in your controller, it should look something like:

Person.find(params[:id])

make sure that params[:id] is not empty, since find will raise a recordnotfound exception if it can't return any records (you can use find_by_id to avoid raising an exception in the event of no matching records found, although usually you'll want to make sure you handle either case programmatically).

Mike

Thanks and yes the code is correct and as I said before I didn't touch the code at all. I was just trying to see how the scaffold works so I didn't change anything on the code.

Found the problem. In my table the primary key had a different name then id. When I change the primary key of the table to id everything worked.