I am currently developing 2 sites that have identical functionality for a single client, but the client wants to combine the admin in the backend for ease of use. The sites will share a single database, users table, etc.
How can I set up a Rails application so that the domain name is the only flag that determines which site a user is signing up for, as well as what content they see when they're logged in?
Details
I have two photography websites: photosoftrains.com and planephotos.com. The sites will have identical functionality, but completely different visual designs. A site visitor that goes to photosoftrains.com should see the train site (train background, train content, train photos). If they register, they can comment and upload photos of trains to the site. If that same logged-in user goes to planephotos.com, they would have to re-register to interact with the site. Otherwise, they could still browse the site as an unregistered user.
Babysteps
- What is the best way to detect the domain name, and redirect the not-logged-in user to the appropriate home page?
- How can I set a global variable when the user starts interacting with one of the specific sites, so that browsing or adding content is completely segregated from the other site, but as efficient as possible?
Is this even possible, or should I separate them into two completely different apps that simply share the database?