routting question

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 ?

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.

map.resources :compunds, :member => { :calculator => :get }

change :get to be whatever verb you need.

This should work:

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

You need to add a member option to your route.

Please read http://frozenplague.net/2008/01/06/restful-routing-an-overview/

Verbs are:

:get, :post, :put, :delete and :any