instance method
refresh
Ruby on Rails 5.2.8.1
Since v3.1.12 Last seen in v6.0.6Signature
refresh(view)
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).
Parameters
-
viewreq
Source
# File actionview/lib/action_view/template.rb, line 177
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
Defined in actionview/lib/action_view/template.rb line 177
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Template