40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/template_streaming.rb', line 40
def render_with_template_streaming(*args, &block)
options = args.first { |a| a.is_a?(Hash) }
if options && options.size == 1 && options.key?(:stream)
options[:template] = default_template
options[:layout] = true
end
push_render_stack_frame do |stack_height|
if start_streaming_template?(stack_height, *args)
@streaming_template = true
@template.streaming_template = true
@performed_render = true
@streaming_body = StreamingBody.new(template_streaming_threshold) do
cookies.freeze
if self.class.session_store.
session.freeze
flash.freeze
end
@performed_render = false
last_piece = render_without_template_streaming(*args, &block)
push last_piece
end
response.body = @streaming_body
response.prepare!
form_authenticity_token
flash @template_streaming_flash = @_flash
request.env[STREAMING_KEY] = true
run_callbacks :when_streaming_template
else
render_without_template_streaming(*args, &block)
end
end
end
|