Made ActionView::Base#render_file private
This commit is contained in:
parent
6f5327013d
commit
ad772402c4
|
@ -1,5 +1,7 @@
|
||||||
*Edge*
|
*Edge*
|
||||||
|
|
||||||
|
* Made ActionView::Base#render_file private [Josh Peek]
|
||||||
|
|
||||||
* Fix polymorphic_url with singleton resources. #461 [Tammer Saleh]
|
* Fix polymorphic_url with singleton resources. #461 [Tammer Saleh]
|
||||||
|
|
||||||
* Replaced TemplateFinder abstraction with ViewLoadPaths [Josh Peek]
|
* Replaced TemplateFinder abstraction with ViewLoadPaths [Josh Peek]
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ module ActionController #:nodoc:
|
||||||
def render_for_file(template_path, status = nil, use_full_path = false, locals = {}) #:nodoc:
|
def render_for_file(template_path, status = nil, use_full_path = false, locals = {}) #:nodoc:
|
||||||
add_variables_to_assigns
|
add_variables_to_assigns
|
||||||
logger.info("Rendering #{template_path}" + (status ? " (#{status})" : '')) if logger
|
logger.info("Rendering #{template_path}" + (status ? " (#{status})" : '')) if logger
|
||||||
render_for_text(@template.render_file(template_path, use_full_path, locals), status)
|
render_for_text(@template.render(:file => template_path, :use_full_path => use_full_path, :locals => locals), status)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_for_text(text = nil, status = nil, append_response = false) #:nodoc:
|
def render_for_text(text = nil, status = nil, append_response = false) #:nodoc:
|
||||||
|
|
|
@ -254,7 +254,7 @@ module ActionController #:nodoc:
|
||||||
@template.instance_variable_set("@content_for_layout", content_for_layout)
|
@template.instance_variable_set("@content_for_layout", content_for_layout)
|
||||||
response.layout = layout
|
response.layout = layout
|
||||||
status = template_with_options ? options[:status] : nil
|
status = template_with_options ? options[:status] : nil
|
||||||
render_for_text(@template.render_file(layout, true), status)
|
render_for_text(@template.render(layout), status)
|
||||||
else
|
else
|
||||||
render_with_no_layout(options, extra_options, &block)
|
render_with_no_layout(options, extra_options, &block)
|
||||||
end
|
end
|
||||||
|
|
|
@ -178,7 +178,7 @@ module ActionController #:nodoc:
|
||||||
@template.instance_variable_set("@rescues_path", File.dirname(rescues_path("stub")))
|
@template.instance_variable_set("@rescues_path", File.dirname(rescues_path("stub")))
|
||||||
@template.send!(:assign_variables_from_controller)
|
@template.send!(:assign_variables_from_controller)
|
||||||
|
|
||||||
@template.instance_variable_set("@contents", @template.render_file(template_path_for_local_rescue(exception), false))
|
@template.instance_variable_set("@contents", @template.render(:file => template_path_for_local_rescue(exception), :use_full_path => false))
|
||||||
|
|
||||||
response.content_type = Mime::HTML
|
response.content_type = Mime::HTML
|
||||||
render_for_file(rescues_path("layout"), response_code_for_rescue(exception))
|
render_for_file(rescues_path("layout"), response_code_for_rescue(exception))
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
</h1>
|
</h1>
|
||||||
<pre><%=h @exception.clean_message %></pre>
|
<pre><%=h @exception.clean_message %></pre>
|
||||||
|
|
||||||
<%= render_file(@rescues_path + "/_trace.erb", false) %>
|
<%= render(:file => @rescues_path + "/_trace.erb", :use_full_path => false) %>
|
||||||
|
|
||||||
<%= render_file(@rescues_path + "/_request_and_response.erb", false) %>
|
<%= render(:file => @rescues_path + "/_request_and_response.erb", :use_full_path => false) %>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<% @real_exception = @exception
|
<% @real_exception = @exception
|
||||||
@exception = @exception.original_exception || @exception %>
|
@exception = @exception.original_exception || @exception %>
|
||||||
<%= render_file(@rescues_path + "/_trace.erb", false) %>
|
<%= render(:file => @rescues_path + "/_trace.erb", :use_full_path => false) %>
|
||||||
<% @exception = @real_exception %>
|
<% @exception = @real_exception %>
|
||||||
|
|
||||||
<%= render_file(@rescues_path + "/_request_and_response.erb", false) %>
|
<%= render(:file => @rescues_path + "/_request_and_response.erb", :use_full_path => false) %>
|
||||||
|
|
|
@ -228,26 +228,6 @@ module ActionView #:nodoc:
|
||||||
@view_paths = ViewLoadPaths.new(Array(paths))
|
@view_paths = ViewLoadPaths.new(Array(paths))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders the template present at <tt>template_path</tt>. If <tt>use_full_path</tt> is set to true,
|
|
||||||
# it's relative to the view_paths array, otherwise it's absolute. The hash in <tt>local_assigns</tt>
|
|
||||||
# is made available as local variables.
|
|
||||||
def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc:
|
|
||||||
if defined?(ActionMailer) && defined?(ActionMailer::Base) && controller.is_a?(ActionMailer::Base) && !template_path.include?("/")
|
|
||||||
raise ActionViewError, <<-END_ERROR
|
|
||||||
Due to changes in ActionMailer, you need to provide the mailer_name along with the template name.
|
|
||||||
|
|
||||||
render "user_mailer/signup"
|
|
||||||
render :file => "user_mailer/signup"
|
|
||||||
|
|
||||||
If you are rendering a subtemplate, you must now use controller-like partial syntax:
|
|
||||||
|
|
||||||
render :partial => 'signup' # no mailer_name necessary
|
|
||||||
END_ERROR
|
|
||||||
end
|
|
||||||
|
|
||||||
Template.new(self, template_path, use_full_path, local_assigns).render_template
|
|
||||||
end
|
|
||||||
|
|
||||||
# Renders the template present at <tt>template_path</tt> (relative to the view_paths array).
|
# Renders the template present at <tt>template_path</tt> (relative to the view_paths array).
|
||||||
# The hash in <tt>local_assigns</tt> is made available as local variables.
|
# The hash in <tt>local_assigns</tt> is made available as local variables.
|
||||||
def render(options = {}, local_assigns = {}, &block) #:nodoc:
|
def render(options = {}, local_assigns = {}, &block) #:nodoc:
|
||||||
|
@ -323,6 +303,26 @@ If you are rendering a subtemplate, you must now use controller-like partial syn
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
# Renders the template present at <tt>template_path</tt>. If <tt>use_full_path</tt> is set to true,
|
||||||
|
# it's relative to the view_paths array, otherwise it's absolute. The hash in <tt>local_assigns</tt>
|
||||||
|
# is made available as local variables.
|
||||||
|
def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc:
|
||||||
|
if defined?(ActionMailer) && defined?(ActionMailer::Base) && controller.is_a?(ActionMailer::Base) && !template_path.include?("/")
|
||||||
|
raise ActionViewError, <<-END_ERROR
|
||||||
|
Due to changes in ActionMailer, you need to provide the mailer_name along with the template name.
|
||||||
|
|
||||||
|
render "user_mailer/signup"
|
||||||
|
render :file => "user_mailer/signup"
|
||||||
|
|
||||||
|
If you are rendering a subtemplate, you must now use controller-like partial syntax:
|
||||||
|
|
||||||
|
render :partial => 'signup' # no mailer_name necessary
|
||||||
|
END_ERROR
|
||||||
|
end
|
||||||
|
|
||||||
|
Template.new(self, template_path, use_full_path, local_assigns).render_template
|
||||||
|
end
|
||||||
|
|
||||||
def wrap_content_for_layout(content)
|
def wrap_content_for_layout(content)
|
||||||
original_content_for_layout, @content_for_layout = @content_for_layout, content
|
original_content_for_layout, @content_for_layout = @content_for_layout, content
|
||||||
yield
|
yield
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
xml.html do
|
xml.html do
|
||||||
xml.p "Hello #{@name}"
|
xml.p "Hello #{@name}"
|
||||||
xml << render_file("test/greeting")
|
xml << render("test/greeting")
|
||||||
end
|
end
|
Loading…
Reference in New Issue