Login chooses database


I just finishes my first RoR application and I’m happy that nearly every
problem I had was solved. But now I need your help. The problem is that
an other organisation wants to use my application as well. The server
will stay the same, but the want to have a seperate database (with the
same structure as the first one). I don’t want to copy my
application-files because this would be very unpractible for the further
Unfortunately I have no idea how to realize this. May I put in a
selection field to the loginform, where the user chooses his
organisation? Is it possible that useres of different organisation work
at the same time with the apllication with different databases? Is there
a possibility with the session?
I treasure every hint!

Thanks a lot


How about using a single Rails app and configuring your apache or
webserver to point two domain names to the same application. Then,
based on the domain in the login request, you can determine how to
authenticate your user.

On your “User” model, would associate each user with a domain (ex.
domain1 or domain2) which would govern business logic depending on
the user.

On Mar 27, 5:15 pm, Rike H. [email protected]

I just finishes my first RoR application

Good for you. And now someone else wants to use it, even better!

As to how to do this, one reliable way to do this is to use version
control and capistrano.

version control
If you have not added your code base to a version control repository,
now is the time to do this. Whether you choose to use subversion or
git, setup a server in your environment to keep incremental changes to
your application there. Version control gives you the ability to name
your versions.

once you have your repository, you “deploy” new versions of your
application to any number of servers. In this case, you have two
“users” of your app. So whether the apps are housed on the same
server, or two servers, you use capistrano to write
“recipes” (scripts) to deploy to the target servers.

It is a proven, scalable way of doing what you want. Then, anytime
something changes, as it always happens, you have the choice to apply
your changes to one or both apps, and affect one or the two databases.
Keeps things under control.

Good luck, and congrats again.

Thanks a lot for your good tipps! This means I have to copy the whole
application to f.e. a subdomain? So if 3 other organisations want to use
this application I copy the whole code three times? Ok. So when I have a
new version then capsitrano helps me to update the other apps? Right?
… I think this will be a not trivial job…
I know git a (very) little bit. It seems that I have to go in with this.
:slight_smile: So, thank you again - I will try this.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs