Forum: Ruby on Rails scaffold seems broken on show,edit,delete

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E7a61d2d3ea43efaeef1e943dfe96914?d=identicon&s=25 John John (john)
on 2006-01-09 18:19
(Received via mailing list)
After running generate scaffold and pointing the browser, the data list
appears correctly, the create new button works okay, but show, edit,
delete give the following error:
"Could not find Organization without an ID"

running on ubuntu breezy with postgresql - data and everything else
appears correct - any ideas?
71f1b6b2c3fd9af2e8c52618fb91caa6?d=identicon&s=25 Jules (Guest)
on 2006-01-09 18:58
What is your show-url? Is it:

http://yourapp/organizations/show

Or is the id included in the url:

http://yourapp/organizations/show/1

It should be like the latter url.
That might be your problem.
E7a61d2d3ea43efaeef1e943dfe96914?d=identicon&s=25 John John (john)
on 2006-01-09 19:29
(Received via mailing list)
The links on the list output only show the action, not the index value.

But when I tried "../show/1" - I get an error about the id field not
found.  The organization table has a primary key called
"organization_id" - Does Rails require the primary key to be named only
"id" ?  btw I'm running Ruby 1.8.3 and Rails 1.0.
71f1b6b2c3fd9af2e8c52618fb91caa6?d=identicon&s=25 Jules Jacobs (jules)
on 2006-01-09 19:34
Yes, Rails needs a primary key "id", and not "organization_id". (unless
you override it in your model, but "id" is better)
E7a61d2d3ea43efaeef1e943dfe96914?d=identicon&s=25 John John (john)
on 2006-01-09 22:15
(Received via mailing list)
Thanks - it works fine now.  Missed this in the docs.
This topic is locked and can not be replied to.