Forum: Ruby on Rails Rails Recipes Book: Routing Error

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.
E4b8c35c29cfcaea3c2101193417466b?d=identicon&s=25 Gene Kahn (kublai)
on 2006-04-24 21:56
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.
455ac2a64d06dc8461f4d258d7f7e980?d=identicon&s=25 Michael Trier (Guest)
on 2006-04-24 23:25
(Received via mailing list)
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.
E4b8c35c29cfcaea3c2101193417466b?d=identicon&s=25 Gene Kahn (kublai)
on 2006-04-25 05:50
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 Trier 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.
455ac2a64d06dc8461f4d258d7f7e980?d=identicon&s=25 Michael Trier (Guest)
on 2006-04-26 00:14
(Received via mailing list)
Nothing odd here. What about your config/routing.rb file.

Michael
This topic is locked and can not be replied to.