Class: ActiveRecord::IdentityMap::Middleware

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/identity_map.rb

Defined Under Namespace

Classes: Body

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



150
151
152
# File 'activerecord/lib/active_record/identity_map.rb', line 150

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



154
155
156
157
158
159
# File 'activerecord/lib/active_record/identity_map.rb', line 154

def call(env)
  enabled = IdentityMap.enabled
  IdentityMap.enabled = true
  status, headers, body = @app.call(env)
  [status, headers, Body.new(body, enabled)]
end