1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Seb Jacobs 2019-03-13 17:04:30 +00:00
parent 1cdc6c6576
commit 47fea39ed6
3 changed files with 3 additions and 3 deletions

View file

@ -267,7 +267,7 @@ module ActionView #:nodoc:
_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

View file

@ -173,7 +173,7 @@ module ActionView
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)

View file

@ -27,7 +27,7 @@ module ActionView
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