views:

895

answers:

1

I have fresh Rails 2.2 install, thing is that everything work fine until I use scaffold generator.

$ script/generate scaffold pages \
  title:string description:string content:text

$ rake db:migrate

But when I launch server with this address: http://localhost:3000/pages/ I get this:

NoMethodError in PagesController#index
undefined method `find' for ActionController::Caching::Pages:Module

app/controllers/pages_controller.rb:5:in 'index'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in 'send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:1253:in 'perform_action_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/filters.rb:617:in 'call_filters'
...

I can't get what I've done wrong? Is that new Rails specific stuff?

+4  A: 

The name of the resource should be in singular. So try

script/generate scaffold page title:string description:string content:text

instead of pages.

Furthermore, your call of the scaffold generator creates Pages model which has the same name as module ActionController::Caching::Pages that is available from your controller and Rails gets confused (because Pages module has no such a method as find).

Milan Novota
this works, Pages are the reason, but what've call controller for CMS to manage pages?
totocaster