fusemedia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-19 16:55 UTC
Re-post: Problem with dashes in URL / Routes
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. domain.com/controller/action/some+variable/ ). 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 :requirements? Thanks in Advance, Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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, Nick -- http://railshostinginfo.com Review Rails hosting companies -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---