Flowdock
method

_pick_template

Importance_0
Ruby on Rails latest stable (v4.1.8) - 0 notes - Class: ActionView::Base
  • 1.0.0
  • 1.1.1
  • 1.1.6
  • 1.2.0
  • 1.2.6
  • 2.0.0
  • 2.0.3
  • 2.1.0
  • 2.2.1 (0)
  • 2.3.2
  • 2.3.8
  • 3.0.0
  • 3.0.5
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.3
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • What's this?

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.2.1) is shown here.

_pick_template(template_path) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_view/base.rb, line 305
      def _pick_template(template_path)
        return template_path if template_path.respond_to?(:render)

        path = template_path.sub(/^\//, '')
        if m = path.match(/(.*)\.(\w+)$/)
          template_file_name, template_file_extension = m[1], m[2]
        else
          template_file_name = path
        end

        # OPTIMIZE: Checks to lookup template in view path
        if template = self.view_paths["#{template_file_name}.#{template_format}"]
          template
        elsif template = self.view_paths[template_file_name]
          template
        elsif @_render_stack.first && template = self.view_paths["#{template_file_name}.#{@_render_stack.first.format_and_extension}"]
          template
        elsif template_format == :js && template = self.view_paths["#{template_file_name}.html"]
          @template_format = :html
          template
        else
          template = Template.new(template_path, view_paths)

          if self.class.warn_cache_misses && logger
            logger.debug "[PERFORMANCE] Rendering a template that was " +
              "not found in view path. Templates outside the view path are " +
              "not cached and result in expensive disk operations. Move this " +
              "file into #{view_paths.join(':')} or add the folder to your " +
              "view path list"
          end

          template
        end
      end
Register or log in to add new notes.