From 97b0bc424075f7352255c0cc5cf578d659e730e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Kro=CC=88ger?= Date: Mon, 31 Oct 2016 12:08:54 +0100 Subject: [PATCH] Bugfix for missing ActionController::TestRequest Fixed a bug where helpers were used inside a decorator and this decorator was used outside of controller context --- CHANGELOG.md | 2 ++ lib/draper/view_context/build_strategy.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ef9c72..eaa0118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Draper Changelog +* Fixed a bug where helpers were used inside a decorator and this decorator was used outside of controller context + ## 3.0.0.pre1 - 2016-07-10 * Added support for Rails 5, dropped 4.0 - 4.2 diff --git a/lib/draper/view_context/build_strategy.rb b/lib/draper/view_context/build_strategy.rb index eb3138b..94fef2b 100644 --- a/lib/draper/view_context/build_strategy.rb +++ b/lib/draper/view_context/build_strategy.rb @@ -38,7 +38,7 @@ module Draper def controller (Draper::ViewContext.controller || ApplicationController.new).tap do |controller| - controller.request ||= new_test_request controller + controller.request ||= new_test_request controller if defined?(ActionController::TestRequest) end end