# "-" instead of "\_" in routes?

**URL:** <https://www.ruby-forum.com/t/instead-of-in-routes/131172>\
**Category:** Rails\
**Created:** [March 6, 2008, 5:41pm UTC](https://www.ruby-forum.com/t/instead-of-in-routes/131172 "2008-03-06T17:41:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 6, 2008, 5:41pm UTC](https://www.ruby-forum.com/t/instead-of-in-routes/131172/1 "2008-03-06T17:41:16Z")

</div>

Hi all

I don’t like “www.mysite.xx/some\_cool\_controller”, I’d rather like to  
have “www.mysite.xx/some-cool-controller”.

Is there an easy way to achieve this? 🙂

Thanks  
Josh

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 6, 2008, 5:49pm UTC](https://www.ruby-forum.com/t/instead-of-in-routes/131172/2 "2008-03-06T17:49:07Z")

</div>

> I don’t like “www.mysite.xx/some\_cool\_controller”, I’d rather like to  
> have “www.mysite.xx/some-cool-controller”.
> 
> Is there an easy way to achieve this? 🙂

There’s not a magical plugin if that’s what you mean. I looked into it  
once and you run into some problems with how Rails converts urls to  
class  
names.

Use named routes…

map.with\_options :controller =\> ‘refer\_a\_friend’ do |r|  
r.refer\_a\_friend ‘refer-a-friend’, :action =\> ‘index’  
r.send\_referrals ‘refer-a-friend/send-referrals’, :action =\>  
‘send\_referrals’  
r.referrals\_sent ‘refer-a-friend/referrals-sent’, :action =\>  
‘referrals\_sent’  
end

etc…

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 6, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/instead-of-in-routes/131172/3 "2008-03-06T18:02:25Z")

</div>

Thanks, but that’s clearly too ugly to me. 😉

Maybe there should be a configuration option to specify the placeholder?  
🙂
