RESTful routes and subdomains

I am looking for a way to use RESTful routes, but include the ability to
add the required subdomain to the url.

I have found a couple plugins, but they don't allow for the RESTful

Does anyone know of any?


Why wouldn’t account_location allow you to use RESTful routes?

You just check the subdomain in a before_filter (if you’re using it as a way of determining the customer account) and the rest is exactly the same as working on a normal website without subdomain authentication.

Best regards

Peter De Berdt

I don't think my question was very clear. I am confused how to include
the subdomain in the routing method call.

# redirect the user to the account cpanel for their subdomain
redirect_to account_url #this url will not include the proper

After checking out the account_location lib file it can be seen that the
equivalent can be done with:
redirect_to :host => account_host(@account.subdomain), :controller =>

The downfall is that I am unable to use the routing methods.

But, as you mentioned, when accessing the subdomain within a controller
it is easy to do so by having a before_filter that extracts it from the
request.subdomains array.