padrino/padrino-framework · error · TemplateNotFound

Template '#{template_path}' not found in '#{view_path}'

Error message

Template '#{template_path}' not found in '#{view_path}'

What it means

Error "Template '#{template_path}' not found in '#{view_path}'" thrown in padrino/padrino-framework.

Source

Thrown at padrino-helpers/lib/padrino/rendering.rb:305

      # @example
      #   get "/foo", provides: [:html, :js] do; render 'path/to/foo'; end
      #   # If you request "/foo.js" with I18n.locale == :ru => [:"/path/to/foo.ru.js", :erb]
      #   # If you request "/foo" with I18n.locale == :de => [:"/path/to/foo.de.haml", :haml]
      #
      def resolve_template(template_path, options = {})
        template_path = template_path.to_s
        controller_key = respond_to?(:request) && request.respond_to?(:controller) && request.controller
        rendering_options = [template_path, content_type || :html, locale]

        settings.cache_template_path(["#{controller_key}/#{template_path}", rendering_options[1], rendering_options[2]]) do
          options = DEFAULT_RENDERING_OPTIONS.merge(options)
          view_path = options[:views] || settings.views || './views'

          template_candidates = glob_templates(view_path, template_path)
          selected_template = select_template(template_candidates, *rendering_options)
          selected_template ||= template_candidates.first unless options[:strict_format]

          raise TemplateNotFound, "Template '#{template_path}' not found in '#{view_path}'" if !selected_template && options[:raise_exceptions]
          selected_template
        end
      end

      ##
      # Return the I18n.locale if I18n is defined.
      #
      def locale
        I18n.locale if defined?(I18n)
      end

      def resolve_layout(layout, options = {})
        layouts_path = options[:layout_options] && options[:layout_options][:views] || options[:views] || settings.views || './views'
        template_path = settings.fetch_layout_path(layout, layouts_path)
        rendering_options = [template_path, content_type || :html, locale]

        settings.cache_template_path(rendering_options) do
          template_candidates = glob_templates(layouts_path, template_path)

View on GitHub (pinned to 167044f3d5)

When it happens

Trigger: Thrown at padrino-helpers/lib/padrino/rendering.rb:305 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23). Data as JSON: /api/errors/d44c8a139e3bdb4f. Report an issue: GitHub.