Class: PhobosDBCheckpoint::Middleware::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/phobos_db_checkpoint/middleware/database.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Database

Returns a new instance of Database.



4
5
6
7
8
# File 'lib/phobos_db_checkpoint/middleware/database.rb', line 4

def initialize(app, options = {})
  @app = app
  PhobosDBCheckpoint.deprecate('options are deprecated, use configuration files instead') if options.keys.any?
  PhobosDBCheckpoint.configure
end

Instance Method Details

#call(request_env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/phobos_db_checkpoint/middleware/database.rb', line 10

def call(request_env)
  ActiveRecord::Base.connection_pool.with_connection do
    @app.call(request_env)
  end
ensure
  ActiveRecord::Base.clear_active_connections!
end