Forum: Ruby on Rails Re-post: Problem with dashes in URL / Routes

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
on 2007-01-19 19:04
(Received via mailing list)
Hey Guys!

First, I am a complete noob at rails. This is my first attempt at a
website using ruby. I've done quite a bit of searching and can't seem
to find the answer to this question. I'm sure its something completely
obvious I'm missing, lol.

I'm having a little issue getting "link_to" to generate URL's with "-"
instead of "+". Some of my URL's may have a variable on the end that
could have spaces ( ie. ).
I would like to replace that "+" with a "-" and then remove the dash
before I query the database with that variable. Is it possible to have
the routes do this automatically? Would I use a regex with

Thanks in Advance,
Nick S. (Guest)
on 2007-01-19 23:42
I would do it in the controller. Get the variable in your controller and
do some+variable.gsub(" ", "-") and then do the query.

Kind regards,

Review Rails hosting companies
This topic is locked and can not be replied to.