Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Deploying app with multiple databases rails

I would like to deploy an app where each organization that sign's up receives a separate subdomain for their task area. I know how to tackle this but how can I go about setting up a new database for that sole organization upon signup? Kind of like generating a wp-config in wordpress or database.yml in RoR.

There is a Gem called apartment that may be of help to you.

https://github.com/influitive/apartment

There is also a Gem called milia

https://github.com/dsaronin/milia

I was developing an app with the intention of creating a database and sub-domain for each user, just as you have described. While researching how to do it, I felt that apartment would be the best fit. However, in the end I simply used a single database, so I do not have any experience with apartment.

Okay, thanks. I was thinking something more along the lines of using establish_connection from the ActiveRecord::Base whenever someone was creating a new account. It would take their connection info as part of the sign-up form (like you would if you were creating a new wordpress install).

Any ideas?