My rails app is a way for users to create their own basic website. So each of them will have a root folder that is example.com/user/1. They will have other pages like example.com/user/1/about etc. How do I configure Rails and Heroku so that something like www.user1.example points to example.com/user/1, and something like www.user1.example/about directs to example.com/user/1/about?
My rails app is a way for users to create their own basic website.
Share
The way I did in my app was first have the list of user domains in the database. Then create an advanced constraint
http://edgeguides.rubyonrails.org/routing.html#advanced-constraints
In this case, my constraint class looks like this:
And then use that constraint in the route
My action then takes a look at request.domain and acts accordingly.