Scaffold seems broken on show,edit,delete


#1

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?


#2

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.


#3

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.


#4

Yes, Rails needs a primary key “id”, and not “organization_id”. (unless
you override it in your model, but “id” is better)


#5

Thanks - it works fine now. Missed this in the docs.