# Multiple views, and some routers

**URL:** <https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344>\
**Category:** Rails\
**Created:** [January 17, 2008, 4:22pm UTC](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344 "2008-01-17T16:22:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@andreh](https://www.ruby-forum.com/u/andreh)\
**Post date:** [January 17, 2008, 4:22pm UTC](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344/1 "2008-01-17T16:22:14Z")

</div>

Hi, I’m new to Rails (just a Java Programmer tired of having to  
configure a lot of xml’s and mapping classes just to make a simple page  
(…))

anyway,  
I’m experiencing some problems with routers, i’ve created a new project  
using Rails 2.0 and created a scaffold for users.

so i have the following:  
users/new.html.erb  
…  
(and the other pages created by the scaffold thing)

now, i want to create a new action list.html.erb

i’m with that default router that when I type /users/1 search for the  
user with id = 1  
how do i call the list.html.erb page? because, when i type /users/list i  
get an error because it’s trying to search for an id = list (?)  
what would be the correct way to map this on routers.rb ?

i have some doubts about the users\_path, users\_url, when scaffold  
generates the page he calls new\_user\_path for example. I didn’t  
understand how that is possible.  
If i creat that list.html.erb page on the users folder, will i be able  
to call an list\_user\_path ?

Sorry if my questions look a little too beginner, maybe i missundertood  
something, and if someone can lead me to the right way, I’ll be very  
grateful!

Thanks,

Andre.

---

<div class="post-metadata">

**Author:** ![andreh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@andreh](https://www.ruby-forum.com/u/andreh)\
**Post date:** [January 17, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344/2 "2008-01-17T17:42:40Z")

</div>

The “users\_path” and “users\_url” methods map to the index action.  
Just add an “index” action to your controller and create a  
“index.html.erb” view file.

Aaron

---

<div class="post-metadata">

**Author:** ![andreh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@andreh](https://www.ruby-forum.com/u/andreh)\
**Post date:** [January 17, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344/3 "2008-01-17T18:03:27Z")

</div>

Aaron wrote:

> The “users\_path” and “users\_url” methods map to the index action.  
> Just add an “index” action to your controller and create a  
> “index.html.erb” view file.
> 
> Aaron

Ok, but what if i want to create a list action instead of a index  
action?  
i have to create a “list” action on the controller, and create a  
“list.html.erb” just the same way?

and about the new\_user\_path, that scaffold uses, i can call  
list\_user\_path?

---

<div class="post-metadata">

**Author:** ![andreh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@andreh](https://www.ruby-forum.com/u/andreh)\
**Post date:** [January 17, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344/4 "2008-01-17T18:08:32Z")

</div>

map.resources :users, :collection =\> { :list =\> :get }

And then you should be able to go to

/users/list

For some reason it won’t make list\_users\_path work (WHY NOT!!!).

-Ryan

On Jan 17, 11:03 am, Andreh L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![andreh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/958977/32.png) [@andreh](https://www.ruby-forum.com/u/andreh)\
**Post date:** [January 17, 2008, 6:24pm UTC](https://www.ruby-forum.com/t/multiple-views-and-some-routers/126344/5 "2008-01-17T18:24:38Z")

</div>

kopf1988 wrote:

> map.resources :users, :collection =\> { :list =\> :get }
> 
> And then you should be able to go to
> 
> /users/list
> 
> For some reason it won’t make list\_users\_path work (WHY NOT!!!).
> 
> -Ryan
> 
> On Jan 17, 11:03ï¿½am, Andreh L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Thanks for the reply! now i just in doubt with the users\_path!

so the “something”\_users\_path is directly related to the routers?  
how does the new\_user\_path and other \_users\_path generated by scaffold  
work?  
i mean, how can i make anothe XXX\_users\_path? is it on the routers.rb?
