How can I change member action names on routes?

I have some controllers with member/collection actions. I want to change
the name of those actions on the routes, so I can translate the action
“/search” to German, for example. How can I do it? I will appreciate any
help.

Currently I am using Rails 2.2.2 and I shoul not change it.

map.resource :search, :controller => “search_controller”

map.suche “suche”, :controller => “search_controller”, :action =>
“new”

Is that what you’re looking for?

Gavin

On Jul 30, 2:23 pm, John S. [email protected]

Gavin M. wrote:

map.resource :search, :controller => “search_controller”

map.suche “suche”, :controller => “search_controller”, :action =>
“new”

Is that what you’re looking for?

Gavin

http://handyrailstips.com

On Jul 30, 2:23�pm, John S. [email protected]

Thanks,

what I want is to get the same url when I wrtie:
http://localhost:3000/articles/search and
http://localhost:3000/articles/suchen

Sorry - there was a typo in my first example:
:controller => “search” - not :controller => “search_controller”

using
map.search “search”, :controller => “search”, :action => “new”
map.suche “suche”, :controller => “search”, :action => “new”

should mean that both /suchen and /search route to the new search
action

I think you may have to explicitly state the relative path in your
links though,
like:
<%= link_to “suchen”, “/suchen” %>
and
<%= link_to “search”, “/search” %>

or if you’re using locales:
<%= link_to t(‘search.name’), “/#{t ‘search.name’}” %>

hope that helps?

Gavin

On Jul 30, 2:53 pm, John S. [email protected]

Gavin M. wrote:

Sorry - there was a typo in my first example:
:controller => “search” - not :controller => “search_controller”

using
map.search “search”, :controller => “search”, :action => “new”
map.suche “suche”, :controller => “search”, :action => “new”

should mean that both /suchen and /search route to the new search
action

I think you may have to explicitly state the relative path in your
links though,
like:
<%= link_to “suchen”, “/suchen” %>
and
<%= link_to “search”, “/search” %>

or if you’re using locales:
<%= link_to t(‘search.name’), “/#{t ‘search.name’}” %>

hope that helps?

Gavin

http://handyrailstips.com

On Jul 30, 2:53�pm, John S. [email protected]

Thanks for the help,

I was looking for something like :as, used to change controller_name on
routes, but for collection and member actions. Any ideas?

I would like to cotinue using REST search_articles_path