Ruby on Rails latest stable (v4.1.8) - 0 notes - Class: ActionView::PathSet

Method deprecated or moved

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

These similar methods exist in v4.1.8:

find_template(original_template_path, format = nil, html_fallback = true) public

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/paths.rb, line 43
    def find_template(original_template_path, format = nil, html_fallback = true)
      return original_template_path if original_template_path.respond_to?(:render)
      template_path = original_template_path.sub(/^\//, '')

      each do |load_path|
        if format && (template = load_path["#{template_path}.#{I18n.locale}.#{format}"])
          return template
        # Try the default locale version if the current locale doesn't have one
        # (i.e. you haven't translated this view to German yet, but you have the English version on hand)
        elsif format && (template = load_path["#{template_path}.#{I18n.default_locale}.#{format}"]) 
          return template
        elsif format && (template = load_path["#{template_path}.#{format}"])
          return template
        elsif template = load_path["#{template_path}.#{I18n.locale}"]
          return template
        elsif template = load_path["#{template_path}.#{I18n.default_locale}"]
          return template
        elsif template = load_path[template_path]
          return template
        # Try to find html version if the format is javascript
        elsif format == :js && html_fallback && template = load_path["#{template_path}.#{I18n.locale}.html"]
          return template
        elsif format == :js && html_fallback && template = load_path["#{template_path}.#{I18n.default_locale}.html"]
          return template
        elsif format == :js && html_fallback && template = load_path["#{template_path}.html"]
          return template

      return Template.new(original_template_path) if File.file?(original_template_path)

      raise MissingTemplate.new(self, original_template_path, format)
Register or log in to add new notes.