From 81a77828bd9405544d51afd5dae97352c97ce76d Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 1 Jun 2015 11:12:34 -0700 Subject: [PATCH] Make rack request object available in template rendering. Closes #1532 --- middleman-core/lib/middleman-core/rack.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/middleman-core/lib/middleman-core/rack.rb b/middleman-core/lib/middleman-core/rack.rb index 2da9ce21..8f6b1609 100644 --- a/middleman-core/lib/middleman-core/rack.rb +++ b/middleman-core/lib/middleman-core/rack.rb @@ -73,8 +73,9 @@ module Middleman # message. # # @param env + # @param [Rack::Request] req # @param [Rack::Response] res - def process_request(env, _, res) + def process_request(env, req, res) start_time = Time.now request_path = URI.decode(env['PATH_INFO'].dup) @@ -100,7 +101,7 @@ module Middleman begin # Write out the contents of the page - res.write resource.render + res.write resource.render({}, { rack: { request: req } }) # Valid content is a 200 status res.status = 200