提交 47fea39e 编写于 作者: S Seb Jacobs

Rename `ActionView::Base#run` to `#_run`

There was a recent change by @tenderlove to Action view which introduced
`ActionView::Base#run` [1].

We ran into an issue with our application because one of the core
concepts in our domain model is a `Run` which is exposed in most of our
views as a helper method, which now conflicts with this new method.

Although this is a public method it is not really meant to be part of
the public API.

In order to discourage public use of this method and to reduce the
chances of this method conflicting with helper methods we can prefix
this method with an underscore, renaming this method to `_run`.

[1] https://github.com/rails/rails/commit/c740ebdaf5
上级 1cdc6c65
......@@ -267,7 +267,7 @@ def initialize(lookup_context = nil, assigns = {}, controller = nil, formats = N
_prepare_context
end
def run(method, template, locals, buffer, &block)
def _run(method, template, locals, buffer, &block)
_old_output_buffer, _old_virtual_path, _old_template = @output_buffer, @virtual_path, @current_template
@current_template = template
@output_buffer = buffer
......
......@@ -173,7 +173,7 @@ def supports_streaming?
def render(view, locals, buffer = ActionView::OutputBuffer.new, &block)
instrument_render_template do
compile!(view)
view.run(method_name, self, locals, buffer, &block)
view._run(method_name, self, locals, buffer, &block)
end
rescue => e
handle_render_error(view, e)
......
......@@ -27,7 +27,7 @@ def evaluate(action_view_erb_handler_context)
include action_view_erb_handler_context._routes.url_helpers
class_eval("define_method(:_template) { |local_assigns, output_buffer| #{src} }", @filename || "(erubi)", 0)
}.empty
view.run(:_template, nil, {}, ActionView::OutputBuffer.new)
view._run(:_template, nil, {}, ActionView::OutputBuffer.new)
end
private
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册