# Noob Question D'Jour

**URL:** <https://www.ruby-forum.com/t/noob-question-djour/181726>\
**Category:** Rails\
**Created:** [January 17, 2010, 4:29am UTC](https://www.ruby-forum.com/t/noob-question-djour/181726 "2010-01-17T04:29:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [January 17, 2010, 4:29am UTC](https://www.ruby-forum.com/t/noob-question-djour/181726/1 "2010-01-17T04:29:11Z")

</div>

Hello and thank you in advance.

I am fairly new to Ruby and Rails and am working on an app in order to  
get more familiar. I feel I should be able to solve this problem on my  
own but have thus far been stymied. Thanks for your help.

I used scaffold to generate the basic index/new/show/edit/destroy  
methods for a given db entries and all works as it should. However, I  
would like to add a new method – say “new\_special” (for example) – in  
the controller.

I would expect to do something like:

[foo\_controller.rb]  
…  
def new\_special  
{some instructions}  
end  
…

however, when I browse to this ([http://localhost:3000/foo/new\_special](http://localhost:3000/foo/new_special)

I see that the engine is trying to invoke the show method and pass it  
“new\_special” as an id. am very confused! I even deleted the ‘show’  
method but it still calls it!

I’ve tried cycling the server and looked everywhere… thanks.

Alex

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [January 17, 2010, 4:40am UTC](https://www.ruby-forum.com/t/noob-question-djour/181726/2 "2010-01-17T04:40:50Z")

</div>

This is easy. Say you have a controller users\_controller.rb, then in  
config/routes.rb change:

map.resources :users

to:

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

If you have any other questions, hit me up via twitter (@kconrails) or  
my blog:

> **[KconRails.com is for sale | HugeDomains](https://www.hugedomains.com/domain_profile.cfm?d=kconrails.com)**
>
> This domain name is available, own it today. Affordable payment options. Fast and professional service.

Jaime

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [January 17, 2010, 5:10am UTC](https://www.ruby-forum.com/t/noob-question-djour/181726/3 "2010-01-17T05:10:44Z")

</div>

Cool. I think I get this (poked a page or two to understand what  
“:collection” was. I’ll play around. thank you very kindly!

Jaime B. wrote:

> This is easy. Say you have a controller users\_controller.rb, then in  
> config/routes.rb change:
> 
> map.resources :users

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [January 17, 2010, 9:22am UTC](https://www.ruby-forum.com/t/noob-question-djour/181726/4 "2010-01-17T09:22:48Z")

</div>

2010/1/17 Jaime B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> This is easy. Â Say you have a controller users\_controller.rb, then in  
> config/routes.rb change:
> 
> map.resources :users
> 
> to:
> 
> map.resources :users, :collection =\> {:new\_special =\> :get}

Another alternative which is often appropriate is to use the standard  
new action but to pass optional additional params in the url to tell  
it what is ‘special’.

Colin
