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.



6
7
8
9
10
# File 'lib/phobos_db_checkpoint/middleware/database.rb', line 6

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



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

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