diff options
author | John Hawthorn <john@hawthorn.email> | 2019-04-04 12:48:52 -0700 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2019-04-04 15:07:14 -0700 |
commit | 151cac65f12e4718317f39254f6a7ccea4ade25b (patch) | |
tree | e88b7b6a27fada104968f72d9de66fee72d6a28e /actionview/lib/action_view | |
parent | db1830a7ec5765909fadb80a8725e52cc37ade07 (diff) | |
download | rails-151cac65f12e4718317f39254f6a7ccea4ade25b.tar.gz rails-151cac65f12e4718317f39254f6a7ccea4ade25b.tar.bz2 rails-151cac65f12e4718317f39254f6a7ccea4ade25b.zip |
Deprecate Template#refresh
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/template.rb | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 291cb8dd9f..b80bf56c1b 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -165,6 +165,7 @@ module ActionView deprecate def formats; Array(format); end deprecate def variants=(_); end deprecate def variants; [variant]; end + deprecate def refresh(_); self; end # Returns whether the underlying handler supports streaming. If so, # a streaming buffer *may* be passed when it starts rendering. @@ -191,25 +192,6 @@ module ActionView @type ||= Types[format] end - # Receives a view object and return a template similar to self by using @virtual_path. - # - # This method is useful if you have a template object but it does not contain its source - # anymore since it was already compiled. In such cases, all you need to do is to call - # refresh passing in the view object. - # - # Notice this method raises an error if the template to be refreshed does not have a - # virtual path set (true just for inline templates). - def refresh(view) - raise "A template needs to have a virtual path in order to be refreshed" unless @virtual_path - lookup = view.lookup_context - pieces = @virtual_path.split("/") - name = pieces.pop - partial = !!name.sub!(/^_/, "") - lookup.disable_cache do - lookup.find_template(name, [ pieces.join("/") ], partial, @locals) - end - end - def short_identifier @short_identifier ||= defined?(Rails.root) ? identifier.sub("#{Rails.root}/", "") : identifier end |