A connection per tenant might cause you to reach your database's connection limit rather quickly. On top of this, AR isn't exactly fast at establishing new connections.
I've done some research into multitenancy systems and I've written a book about it: https://leanpub.com/multi-tenancy-rails-2 The short version is that you should look at the Apartment gem's Postgres schema switching support if you're on a small database, or stick with the regular foreign key scoping (ie tenant_id on the records that belong to a particular tenant) if you're on a large databases. > On 11 Dec 2015, at 07:06, Oliver Legg <[email protected]> wrote: > >> - Make it possible to make connection handler pluggable. I've tried to do >> this, but documentation is lacking and i can't seem to get it work. > > The connection handler is already pluggable. You can configure it like so: > > config.active_record.connection_handler = MyConnectionHandler.new > >> - Make it possible to create connection pools based on specs. > > I believe that it’s already possible to create connection pools based with a > ConnectionSpecification. > https://github.com/rails/rails/blob/v4.2.3/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb#L227-L252 > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
