Forum: Ruby on Rails routing error

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sony S. (Guest)
on 2009-02-20 05:49

       I have set up an application using scaffolding, which have all
basic method(index/new/edit/show/..). But when I tried to add a new
method it showing routing errors.


class ItemsController < ApplicationController
def index
def new

def list
(New method which I have created)



Error what I am getting is that,

Couldn't find Item with ID=list

How can I configure my routes.rb to avoid the issue.

Waiting for ur reply...
LaughingNinja (Guest)
on 2009-02-20 22:51
(Received via mailing list)
Try this:

  map.with_options :controller=>'ItemsController' do | ItemsController
|   "/new",   :action => 'new'
   ItemsController. list  "/list",  :action => 'list'

On Feb 19, 7:49 pm, Sony S. <removed_email_address@domain.invalid>
Dharmdip R. (Guest)
on 2009-02-21 13:07
which  version of rails r u using ?
Gavin (Guest)
on 2009-02-21 15:24
(Received via mailing list)
Hi Sony - Have you specified the route in your routes.rb file?

Try adding

map.resources :items, :member => {:list => :get}


map.resources :items, :collection => {:list => :get} if this action is
not for one specific object at a time.

this will give you list_item_path(@item) or list_items_path

That might help with the routing issue.

Here's a great tutorial on routes:

On Feb 20, 3:49 am, Sony S. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.