30 Aug 2008, 00:33
Generic-user-small

Robby Dhillon (1 post)

Your tutorial on giving users their own unique subdomain or domain is great but lacks one thing:

Request routing in such application. How do you tell rails which controller to use based on URL that is request? Let’s say my product site has the following URL>www.example.com/login ...also, how would I go about have my product site at example.com instead of “>www.example.com are some of my unanswered questions and would help to have them explained in bit more detail. Thank you. Btw, I have already checked out ‘Request Routing’ & ‘Tricky Routes’ plugins but for some reason they both do not play well with Rails 2.1.0. An alternative solution would be helpful without the use of a plugin.

Thanks!

14 Dec 2009, 18:52
Myself_small_pragsmall

Anatoly Mikhaylov (6 posts)

http://github.com/mbleigh/subdomain-fu
Examples:
users_path(:subdomain => “fun”)
users_url(:subdomain => false)
map.with_options :conditions => {:subdomain => ‘admin’} do |admin| admin.resources :posts admin.resources :users
end

SubdomainFu provides a modern implementation of subdomain handling in Rails. It takes aspects from account_location, request_routing, and other snippets found around the web and combines them to provide a single, simple solution for subdomain-based route and url management.

  You must be logged in to comment