Subdomain fu woes

I'm using subdomain_fu successfully and generating subdomain routes like this:

rotues.rb: map.city_root '',:controller => 'cities', :action => 'index', :conditions => { :subdomain => /.+/ }

using it in a view: <%= link_to city.name, city_root_path(:subdomain => city.subdomain)%>

that works well, now I can't figure out how to generate a nested route with subdomain, i.e. miami.site.com/users/1

trying any combination of the form user_path(@user,:subdomain => city.subdomain) does nothing excepnt append a parameter at the end of the url like this:

site.com/users/1?subdomain=miami

help is greatly appreciated guys!

Found the fix, it is a bug with the subdomain_fu plugin.

the solution may be found here

http://www.portallabs.com/blog/2008/10/22/fixing-subdomain_fu-with-named-routes/

In addition to the fix you found, you may also want to check out this patch.

http://rails.lighthouseapp.com/projects/8994/tickets/1115-path-to-extend-named-routes-support-for-an-objects-to_params-method

I wrote that because of a recent site I built with 18 subdomains and not wanting to write out all those links by hand.

In your case above you could define a to_params method on User to return the hash (including the subdomain) and then just do user_path(@user) and it will do the right thing.

Anyway, see the ticket for more info.

-philip