Rails app organization question

Hello--

New to Ruby. New to Rails. New to web app development, quite honestly. I -really- like Rails, though. Forgive me if this is the wrong place for this type of question, and kindly suggest another venue.

I'm working on a new web app that would allow customers (companies) to have multiple logins which access the same database. The question is how to set up something like this--

1. Have one instance of the app and somehow allow it to use different databases depending on the user's login.

2. Have multiple instances of the app running on virtual servers, similar to how cPanel sets up accounts for multiple hosts -- each host has its own directory, MySQL database, and so on. Then, somehow have one "father" web app administer this higher level of hierarchy.

Any other suggestions? My experience in setting this sort of thing up is limited -- are there any good examples of this setup that I could pull from? Is this sort of thing relatively painless to do in Rails?

For example, it seems that the online store UltraCart does a similar thing -- each company gets a company code "DEMO" and can have multiple users with different access permissions.

Thanks very much for any suggestions!

    Cheers,
    Jake

Jake Janovetz wrote:

Hello--

New to Ruby. New to Rails. New to web app development, quite honestly. I -really- like Rails, though. Forgive me if this is the wrong place for this type of question, and kindly suggest another venue.

comp.lang.ruby.rails

I'm working on a new web app that would allow customers (companies) to have multiple logins which access the same database. The question is how to set up something like this--

1. Have one instance of the app and somehow allow it to use different databases depending on the user's login.

2. Have multiple instances of the app running on virtual servers, similar to how cPanel sets up accounts for multiple hosts -- each host has its own directory, MySQL database, and so on. Then, somehow have one "father" web app administer this higher level of hierarchy.

Any other suggestions?

You don't indicate a compelling reason why there should be more than one database.
Simple is better. Simple is faster. You can always build out later. If each customer's
needs are similar then one database is sufficient. If not, then you may be
talking more of a db hosting service, which would probably require separate
databases for each customer, but I doubt you are talking about this. I think
you're saying you are trying to sell some kind of web service to multiple (corporate)
customers, and each company may have more than one account. If that's the case
(depending on the service you are selling), start with just one database.

It sounds like all you need are multiple accounts, which pretty much comes
for free via one of the Rails plugins/generators. Nothing fancy is required if
you're just talking about standard accounts with access controls/roles.

My experience in setting this sort of thing up is limited -- are there any good examples of this setup that I could pull from?

http://www.pragmaticprogrammer.com/titles/rails/

you can also learn an awful lot from just drinking from the firehose,
comp.lang.ruby.rails, for a few days. Will save you tons of time in the long run.

Is this sort of thing relatively painless to do in Rails?

Not painless, just less painful.

···

For example, it seems that the online store UltraCart does a similar thing -- each company gets a company code "DEMO" and can have multiple users with different access permissions.

Thanks very much for any suggestions!

   Cheers,
   Jake