# Custom Routes

**URL:** <https://www.ruby-forum.com/t/custom-routes/186683>\
**Category:** Rails\
**Created:** [April 11, 2010, 1:28pm UTC](https://www.ruby-forum.com/t/custom-routes/186683 "2010-04-11T13:28:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChaosKnight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@ChaosKnight](https://www.ruby-forum.com/u/ChaosKnight)\
**Post date:** [April 11, 2010, 1:28pm UTC](https://www.ruby-forum.com/t/custom-routes/186683/1 "2010-04-11T13:28:53Z")

</div>

Hi, I am busy with a tourism website and I am almost done, but the  
URL’s is starting to bug me…  
I am still a Rails noob, but I am eager to learn as much as possible.  
I already make use of resource  
routes, but I want to display the paths like this: /countries/  
zimbabwe, and: admin/countries/southafrica  
instead of something like: /countries/1… Is this possible?

And would you encourage someone to use routes in that custom way?

One last thing: Is named routes also part of the RESTful routes?

Thanks! I really appreciate your dedication to help others 🙂

---

<div class="post-metadata">

**Author:** ![ChaosKnight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@ChaosKnight](https://www.ruby-forum.com/u/ChaosKnight)\
**Post date:** [April 11, 2010, 3:32pm UTC](https://www.ruby-forum.com/t/custom-routes/186683/2 "2010-04-11T15:32:23Z")

</div>

map ‘countres/:name’, :controller =\> a, :action =\> b

class a \< ActiveController  
def b  
params[:name]  
end  
end

---

<div class="post-metadata">

**Author:** ![ChaosKnight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@ChaosKnight](https://www.ruby-forum.com/u/ChaosKnight)\
**Post date:** [April 12, 2010, 8:25am UTC](https://www.ruby-forum.com/t/custom-routes/186683/3 "2010-04-12T08:25:44Z")

</div>

Hi,  
As you want country name instead of id than pass name field. and in  
show method you have to search according to country name instead of id.

```
As you required admin as prefix. so create namespace and define 

```

routes as  
map.namespace :admin do |admin|  
admin.resources :countries  
end
