3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/ecm/cms/action_view/template_renderer_patch.rb', line 3
def self.included(base)
base.class_eval do
alias_method :original_render, :render
if Rails::VERSION::MAJOR < 4
def render(context, options)
@view = context
@details = (options)
(options[:file] || options[:template], @details)
template = determine_template(options)
context = @lookup_context
unless context.rendered_format
context.formats = template.formats unless template.formats.empty?
context.rendered_format = context.formats.first
end
layout = template.layout if template.respond_to?(:layout)
layout ||= options[:layout]
render_template(template, layout, options[:locals])
end
elsif Rails::VERSION::MAJOR < 5
def render(context, options)
@view = context
@details = (options)
template = determine_template(options)
prepend_formats(template.formats)
@lookup_context.rendered_format ||= (template.formats.first || formats.first)
layout = template.layout if template.respond_to?(:layout)
layout ||= options[:layout]
render_template(template, layout, options[:locals])
end
end
end
end
|