# Routing error

**URL:** <https://www.ruby-forum.com/t/routing-error/160828>\
**Category:** Rails\
**Created:** [February 20, 2009, 4:49am UTC](https://www.ruby-forum.com/t/routing-error/160828 "2009-02-20T04:49:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zonyzeb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/48db29/32.png) [@zonyzeb](https://www.ruby-forum.com/u/zonyzeb)\
**Post date:** [February 20, 2009, 4:49am UTC](https://www.ruby-forum.com/t/routing-error/160828/1 "2009-02-20T04:49:15Z")

</div>

Hello,

```
   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.

```auto

class ItemsController < ApplicationController
def index
..
end
def new
..
end
....
...

def list
(New method which I have created)
end

end

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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...
```

---

<div class="post-metadata">

**Author:** ![zonyzeb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/48db29/32.png) [@zonyzeb](https://www.ruby-forum.com/u/zonyzeb)\
**Post date:** [February 20, 2009, 9:51pm UTC](https://www.ruby-forum.com/t/routing-error/160828/2 "2009-02-20T21:51:40Z")

</div>

Try this:

map.with\_options :controller=\>‘ItemsController’ do | ItemsController  
|  
ItemsController.new “/new”, :action =\> ‘new’  
ItemsController. list “/list”, :action =\> ‘list’  
end

On Feb 19, 7:49 pm, Sony S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![zonyzeb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/48db29/32.png) [@zonyzeb](https://www.ruby-forum.com/u/zonyzeb)\
**Post date:** [February 21, 2009, 12:07pm UTC](https://www.ruby-forum.com/t/routing-error/160828/3 "2009-02-21T12:07:39Z")

</div>

which version of rails r u using ?

---

<div class="post-metadata">

**Author:** ![zonyzeb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/48db29/32.png) [@zonyzeb](https://www.ruby-forum.com/u/zonyzeb)\
**Post date:** [February 21, 2009, 2:24pm UTC](https://www.ruby-forum.com/t/routing-error/160828/4 "2009-02-21T14:24:32Z")

</div>

Hi Sony - Have you specified the route in your routes.rb file?

Try adding

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

or

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:  
[http://guides.rubyonrails.org/routing\_outside\_in.html](http://guides.rubyonrails.org/routing_outside_in.html)

On Feb 20, 3:49 am, Sony S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
