Routing conditions only affect recognition, not URL generati

I am hitting a problem where it seems that URL “:conditions=>” correctly
affect URL recognition, but don’t affect URL generation.

Basically I have two very similar websites which differ slightly in how
they are laid out, but have substantially similar code. I want to use a
bit of routing magic to use a single codebase for both sites. Note: I
use the request_routing plugin to get access to the URL as a condition


map.with_options( :conditions => { :domain => /(^|\.)blog\./ } ) do



map.with_options( :conditions => { :domain => /(^|\.)track\./ } ) do



What happens is that at the “track” site the URLs work correctly if I
type them in manually to the browser, ie they get recognised correctly,
but new URLs are all generated in the scheme for the “blog” site
(because it comes higher up in routing order - if I reverse the routes
then the reverse situation occurs)

How can I get my :conditions to take effect during URL generation as
well as recognition. Examining action_controller/routing.rb isn’t

Suggestions please…

Ed W

I’ve been asking this same question for the last month and keep
getting doors slammed in my face. Mostly, “read the book” type
response (of which I’ve read most of them) and there’s no mention of
I think the secret is keeping all of the HTML ‘wording’ that the user
see and have it read in from the database on all sites.
I’m easily reachable if you’d like to discuss this sometime.

Have you two read the routing articles on Jamis B.s’ site?
Buckblog: Category: under the hood I think you’ll find a good
bit of
information there that’d help out. Specifically the routing_tricks
that Jamis developped. I use it on one of my apps and it’s a godsend.