mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Prefix ActionView::Base private methods with an underscore
This commit is contained in:
parent
56c2b02f59
commit
8eec694598
5 changed files with 13 additions and 12 deletions
|
@ -917,7 +917,7 @@ module ActionController #:nodoc:
|
|||
end
|
||||
|
||||
elsif options[:update]
|
||||
@template.send! :evaluate_assigns_and_ivars
|
||||
@template.send(:_evaluate_assigns_and_ivars)
|
||||
|
||||
generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(@template, &block)
|
||||
response.content_type = Mime::JS
|
||||
|
|
|
@ -218,7 +218,7 @@ module ActionController #:nodoc:
|
|||
# Returns the template of the file which was used to
|
||||
# render this response (or nil)
|
||||
def rendered_template
|
||||
template._first_render
|
||||
template.send(:_first_render)
|
||||
end
|
||||
|
||||
# A shortcut to the flash. Returns an empty hash if no session flash exists.
|
||||
|
|
|
@ -162,7 +162,6 @@ module ActionView #:nodoc:
|
|||
|
||||
attr_accessor :base_path, :assigns, :template_extension
|
||||
attr_accessor :controller
|
||||
attr_accessor :_first_render, :_last_render
|
||||
|
||||
attr_writer :template_format
|
||||
|
||||
|
@ -247,7 +246,7 @@ module ActionView #:nodoc:
|
|||
elsif options.is_a?(Hash)
|
||||
options = options.reverse_merge(:locals => {})
|
||||
if options[:layout]
|
||||
render_with_layout(options, local_assigns, &block)
|
||||
_render_with_layout(options, local_assigns, &block)
|
||||
elsif options[:file]
|
||||
if options[:use_full_path]
|
||||
ActiveSupport::Deprecation.warn("use_full_path option has been deprecated and has no affect.", caller)
|
||||
|
@ -329,8 +328,10 @@ module ActionView #:nodoc:
|
|||
memoize :pick_template
|
||||
|
||||
private
|
||||
attr_accessor :_first_render, :_last_render
|
||||
|
||||
# Evaluate the local assigns and pushes them to the view.
|
||||
def evaluate_assigns_and_ivars
|
||||
def _evaluate_assigns_and_ivars #:nodoc:
|
||||
unless @assigns_added
|
||||
@assigns.each { |key, value| instance_variable_set("@#{key}", value) }
|
||||
|
||||
|
@ -344,13 +345,13 @@ module ActionView #:nodoc:
|
|||
end
|
||||
end
|
||||
|
||||
def set_controller_content_type(content_type)
|
||||
def _set_controller_content_type(content_type) #:nodoc:
|
||||
if controller.respond_to?(:response)
|
||||
controller.response.content_type ||= content_type
|
||||
end
|
||||
end
|
||||
|
||||
def render_with_layout(options, local_assigns, &block)
|
||||
def _render_with_layout(options, local_assigns, &block) #:nodoc:
|
||||
partial_layout = options.delete(:layout)
|
||||
|
||||
if block_given?
|
||||
|
|
|
@ -26,11 +26,11 @@ module ActionView
|
|||
def render(view, local_assigns = {})
|
||||
compile(local_assigns)
|
||||
|
||||
view._first_render ||= self
|
||||
view._last_render = self
|
||||
view.send(:_first_render=, self) unless view.send(:_first_render)
|
||||
view.send(:_last_render=, self)
|
||||
|
||||
view.send(:evaluate_assigns_and_ivars)
|
||||
view.send(:set_controller_content_type, mime_type) if respond_to?(:mime_type)
|
||||
view.send(:_evaluate_assigns_and_ivars)
|
||||
view.send(:_set_controller_content_type, mime_type) if respond_to?(:mime_type)
|
||||
|
||||
view.send(method_name(local_assigns), local_assigns) do |*names|
|
||||
if proc = view.instance_variable_get("@_proc_for_layout")
|
||||
|
|
|
@ -6,7 +6,7 @@ module ActionView
|
|||
include Compilable
|
||||
|
||||
def compile(template)
|
||||
"set_controller_content_type(Mime::XML);" +
|
||||
"_set_controller_content_type(Mime::XML);" +
|
||||
"xml = ::Builder::XmlMarkup.new(:indent => 2);" +
|
||||
"self.output_buffer = xml.target!;" +
|
||||
template.source +
|
||||
|
|
Loading…
Reference in a new issue