# Routting question

**URL:** <https://www.ruby-forum.com/t/routting-question/144670>\
**Category:** Rails\
**Created:** [August 1, 2008, 12:58am UTC](https://www.ruby-forum.com/t/routting-question/144670 "2008-08-01T00:58:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [August 1, 2008, 12:58am UTC](https://www.ruby-forum.com/t/routting-question/144670/1 "2008-08-01T00:58:12Z")

</div>

I have a controller with the default functions index, edit, update…etc  
but i want to add another route calculator.

my current setup:

compounds\_controller.rb  
def index  
…  
def calculator  
…  
end

i also added views/compounds/calculator.html.erb

i have the default entry in the routes:

map.resources :compounds

how can i get it to map to [http://localhost/compounds/calculator](http://localhost/compounds/calculator) ?

i tried doing:

map.calculator ‘/compounds/calculator’, :controller =\> ‘compounds’,  
:action =\> ‘calculator’

but it’s not working.

i tried reading through some of the routes documentation but was getting  
a little confused.

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [August 1, 2008, 1:42am UTC](https://www.ruby-forum.com/t/routting-question/144670/2 "2008-08-01T01:42:37Z")

</div>

This should work:

map.resources :compounds, :collection =\> { :calculator =\> :get }

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [August 1, 2008, 1:42am UTC](https://www.ruby-forum.com/t/routting-question/144670/3 "2008-08-01T01:42:37Z")

</div>

You need to add a member option to your route.

Please read

> **[frozenplague.net](http://frozenplague.net/2008/01/06/restful-routing-an-overview/)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [August 1, 2008, 5:31am UTC](https://www.ruby-forum.com/t/routting-question/144670/4 "2008-08-01T05:31:29Z")

</div>

heimdull wrote:

> This should work:
> 
> map.resources :compounds, :collection =\> { :calculator =\> :get }

thanks! worked great.
