Rails: undefined method `scaffold' for StoryController:Class

I have a copy of the Rails 1 book. I realize that it is from 2007, and that the Rails 2 book has come out. From what I can tell, the same error applies in the newer version of the book too. I have found several errors so far, but have googled and corrected them all and am currently on page 139. Here is a break down of the problem.

As the book instructed on page 140 I changed story_controller.rb to

class StoryController < ApplicationController 
   scaffold :story
end

When I then went to http://localhost:3000/story I got:
Routing Error

undefined method `scaffold’ for StoryController:Class

I googled that and found another thread on this forum, here: http://www.sitepoint.com/forums/showthread.php?t=531057

There it was recommended that I read [URL=“http://www.leonardoborges.com/writings/2007/12/21/rails-20-scaffold/”]http://www.leonardoborges.com/writings/2007/12/21/rails-20-scaffold/
which I did.

That explain that we are supposed to now be using:

rails generate scaffold Story name:string email:string

I am still getting the error:
Routing Error

undefined method `scaffold’ for StoryController:Class

Please help me out. I would like to keep moving forward. I can tell that I am learning, but I don’t know enough to get over this hurdle. Thanks!!!

I have been playing around with so many things, trying to do things different ways. This might be the answer. I am not even sure. Check the answer in this thread: http://www.sitepoint.com/forums/showthread.php?p=3763620

If someone else reads this, and knows for sure that this ISN’T the answer, please reply.

Thanks!

Scaffolds in rails are just a way to create views directly from a model and you should not use this in all of your models. Because you need to learn how things work in rails such as how routes, views, model and controller are working together.

I recommended to use ryan bates nifty_generators https://github.com/ryanb/nifty-generators

Hi. The Rails Guides have a good section on scaffolding and the resulting routes that explains everything pretty clearly: http://guides.rubyonrails.org/getting_started.html#getting-up-and-running-quickly-with-scaffolding