473183469
473183469

Reputation: 243

active record stand alone: connection pooling

Using activerecord outside rails, may I be confident all the connection drudgework is performed behind the curtains the same as inside rails?

In rails, activerecord does a great job establishing a connection pool and activating or closing connection as needed.

If I have a ruby daemon which calls a class file with:

ActiveRecord::Base.establish_connection(:production)
# more active_record tasks

can I assume on the following calls a connection from a pool is used?

Upvotes: 0

Views: 188

Answers (1)

Mike Gorski
Mike Gorski

Reputation: 1228

Yup, calling ActiveRecord::Base.establish_connection will create a connection pool according to: https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb#L842

Upvotes: 1

Related Questions