Reputation: 3165
I'm trying to compare the start time of a response to various places inside the code. Does rails have any magic that gives you response start time, or would I have to write my own middleware?
Upvotes: 1
Views: 123
Reputation: 11929
I think the easiest way is to use custome middleware
Railscast : http://asciicasts.com/episodes/151-rack-middleware
Not tested example
class TimestampMiddleware
def initialize(app)
@app = app
end
def call(env)
env[:timestamp] = Time.now
@app.call(env)
end
end
Register middleware
Rails::Initializer.run do |config|
config.middleware.use "TimestampMiddleware"
end
Upvotes: 1