Rails and Stuff at Abel killed Cain

Ruby on Rails and other Webdevelopment

Posts Tagged ‘ routes ’

I had the following problem to solve using rails:

  1. Having 2 Subdomains, www and clients
  2. a client always has a path-prefix to use google analytics for each of this subdirs. so i had the following urls:
    www.domain.tld/foo.html  and clients.domain.tld/3kunsdf7w/foo.html
  3. I did not want to have a code on www.
  4. i did not want to alter all tempaltes with new paramters and differen routes

Solving this, it was ok for me to duplicate all routes with a client_  prefix using textmate, so i took onl 4 seconds.. but what next, how to tell rails to use the clients_xy_path when i call xy_path?

[More]

Routes in Rails are great. No doubt!

Anyways, it fails at URLs like “category/articleid-a-few-words-headline-stub.html” etc. if you try the following:

1
map.article '/:article-:stub.html', :controller=>'article', :action=>'show'

therefore here a quick workaround to get nice dashes in routes with article-id and so on.. [More]