Exception: ActionView::MissingTemplate

Inherits:
ActionViewError show all
Defined in:
lib/action_view/template/error.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths, path, prefixes, partial, details) ⇒ MissingTemplate

Returns a new instance of MissingTemplate.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/action_view/template/error.rb', line 33

def initialize(paths, path, prefixes, partial, details, *)
  @path = path
  prefixes = Array(prefixes)
  template_type = if partial
    "partial"
  elsif /layouts/i.match?(path)
    "layout"
  else
    "template"
  end

  if partial && path.present?
    path = path.sub(%r{([^/]+)$}, "_\\1")
  end
  searched_paths = prefixes.map { |prefix| [prefix, path].join("/") }

  out  = "Missing #{template_type} #{searched_paths.join(", ")} with #{details.inspect}. Searched in:\n"
  out += paths.compact.map { |p| "  * #{p.to_s.inspect}\n" }.join
  super out
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



31
32
33
# File 'lib/action_view/template/error.rb', line 31

def path
  @path
end