From c556ffdb120d84bd7589a688cccb6d264440b76e Mon Sep 17 00:00:00 2001 From: Juerg Ritter Date: Tue, 19 Aug 2014 15:24:55 +0200 Subject: [PATCH] only include hook if partial is available. Removes conflict with jbuilder and also resolves bug #37 --- lib/paloma/action_controller_extension.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/paloma/action_controller_extension.rb b/lib/paloma/action_controller_extension.rb index c1dea30..97a3232 100644 --- a/lib/paloma/action_controller_extension.rb +++ b/lib/paloma/action_controller_extension.rb @@ -115,10 +115,15 @@ module Paloma # def append_paloma_hook return true if self.paloma.has_no_request? - - hook = view_context.render( - :partial => 'paloma/hook', - :locals => {:request => self.paloma.request}) + + # Render the partial if it is present, otherwise do nothing. + begin + hook = view_context.render( + :partial => 'paloma/hook', + :locals => {:request => self.paloma.request}) + rescue ActionView::MissingTemplate + return true + end before_body_end_index = response_body[0].rindex('')