Rails Recipes Book: Routing Error

Hi,
I’m working on the first rails recipe, InPlaceEditing, and following the
instructions very carefully. After generating the scaffold for Contact,
I then go to the page, thus:

http://localhost:3000/contacts/

I get this error:

Routing Error
Recognition failed for “/contacts/”

What should I be checking for to resolve this problem?

Thanks.

You probably don’t still have the output of your script/generate. How
about showing us your controller
/app/controllers/contacts_controller.rb. Also make sure you have all
the views that are listed in the Recipe book, in the output of the
script/generate command.

Michael.

Thanks for the reply.

There are 6 files in views/contacts:
_form.rhtml, list.rhtml, show.rhtml, edit.rhtml, new.rhtml,
show.rhtml.default.
There are 2 files in views/layouts:
application.rhtml, contacts.rhtml

Here’s what’s in contacts_controller.rb:

#—

Excerpted from “Rails Recipes”

We make no guarantees that this code is fit for any purpose.

Visit http://www.pragmaticprogrammer.com/titles/fr_rr for more book

information.
#—
class ContactsController < ApplicationController

Contact.content_columns.each do |column|
in_place_edit_for :contact, column.name
end

def index
list
render :action => ‘list’
end

def list
@contact_pages, @contacts = paginate :contacts, :per_page => 10
end

def show
@contact = Contact.find(params[:id])
end

def new
@contact = Contact.new
end

def create
@contact = Contact.new(params[:contact])
if @contact.save
flash[:notice] = ‘Contact was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

def edit
@contact = Contact.find(params[:id])
end

def update
@contact = Contact.find(params[:id])
if @contact.update_attributes(params[:contact])
flash[:notice] = ‘Contact was successfully updated.’
redirect_to :action => ‘show’, :id => @contact
else
render :action => ‘edit’
end
end

def destroy
Contact.find(params[:id]).destroy
redirect_to :action => ‘list’
end
end

Thanks for the help!

Michael T. wrote:

You probably don’t still have the output of your script/generate. How
about showing us your controller
/app/controllers/contacts_controller.rb. Also make sure you have all
the views that are listed in the Recipe book, in the output of the
script/generate command.

Michael.

Nothing odd here. What about your config/routing.rb file.

Michael