method
_pick_template
Ruby on Rails latest stable (v2.3.4)
-
0 notes -
Class: ActionView::Base
- v1.0.0
- v1.1.0
- v1.1.1
- v1.1.2
- v1.1.3
- v1.1.4
- v1.1.5
- v1.1.6
- v1.2.0
- v1.2.1
- v1.2.2
- v1.2.3
- v1.2.4
- v1.2.5
- v1.2.6
- v2.0.0
- v2.0.1
- v2.0.2
- v2.0.3
- v2.1.0
- 2.2.1 (0)
- v2.3.2
- v2.3.4
- What's this?
_pick_template(template_path)
private
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

