From 32c2d48eaad88624dba70a1defe0d3f0f96323f5 Mon Sep 17 00:00:00 2001 From: Nagy Bence Date: Sun, 31 Jul 2011 09:44:39 +0200 Subject: [PATCH 1/3] using extract_options! for options --- lib/template_streaming.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/template_streaming.rb b/lib/template_streaming.rb index 11f964b..af685ef 100644 --- a/lib/template_streaming.rb +++ b/lib/template_streaming.rb @@ -38,8 +38,8 @@ def action_streams? end def render_with_template_streaming(*args, &block) - options = args.first { |a| a.is_a?(Hash) } - if options && options.size == 1 && options.key?(:stream) + options = args.extract_options! + if options.key?(:stream) # Need to set the default values, since the standard #render won't. options[:template] = default_template options[:layout] = true From e72621a2d3e3d9a06f1c76302f5915acdb9d4877 Mon Sep 17 00:00:00 2001 From: Nagy Bence Date: Sun, 31 Jul 2011 13:28:41 +0200 Subject: [PATCH 2/3] fixed last change --- lib/template_streaming.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/template_streaming.rb b/lib/template_streaming.rb index af685ef..a8507d0 100644 --- a/lib/template_streaming.rb +++ b/lib/template_streaming.rb @@ -38,7 +38,7 @@ def action_streams? end def render_with_template_streaming(*args, &block) - options = args.extract_options! + options = args.last.is_a?(Hash) ? args.last : {} if options.key?(:stream) # Need to set the default values, since the standard #render won't. options[:template] = default_template @@ -396,3 +396,4 @@ def pre_process_with_template_streaming(*args, &block) require 'template_streaming/error_recovery' require 'template_streaming/caching' require 'template_streaming/autoflushing' + From 0cd58a26c0045b5db675c42f9a00a92ac183cc23 Mon Sep 17 00:00:00 2001 From: Nagy Bence Date: Mon, 15 Aug 2011 00:39:08 +0200 Subject: [PATCH 3/3] added redirection to exception (the same as in http://rubydoc.info/github/rails/rails/master/ActionController/Streaming) --- lib/template_streaming/error_recovery.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/template_streaming/error_recovery.rb b/lib/template_streaming/error_recovery.rb index 41c2caf..e2d4729 100644 --- a/lib/template_streaming/error_recovery.rb +++ b/lib/template_streaming/error_recovery.rb @@ -192,7 +192,7 @@ def render_with_template_streaming_error_recovery(*args, &block) controller.streaming_error_callbacks.each{|c| c.call(e)} exceptions = controller.request.env[EXCEPTIONS_KEY] and exceptions << e - '' + '">' end else render_without_template_streaming_error_recovery(*args, &block)