instance method refresh

Ruby on Rails 4.0.13

Since v3.1.12 Last seen in v6.0.6

Available in: v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6

Signature

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

view req
Source
# File actionpack/lib/action_view/template.rb, line 167
    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 actionpack/lib/action_view/template.rb line 167 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionView::Template

Type at least 2 characters to search.

↑↓ navigate · open · esc close