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.



145
146
147
# File 'activerecord/lib/active_record/identity_map.rb', line 145

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

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