Exception: ActionView::MissingTemplate

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

Overview

:nodoc:

Defined Under Namespace

Classes: Correction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of MissingTemplate.


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

def initialize(paths, path, prefixes, partial, details, *)
  if partial && path.present?
    path = path.sub(%r{([^/]+)$}, "_\\1")
  end

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

  searched_paths = @prefixes.map { |prefix| [prefix, path].join("/") }

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

Instance Attribute Details

#partialObject (readonly)

Returns the value of attribute partial


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

def partial
  @partial
end

#pathObject (readonly)

Returns the value of attribute path


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

def path
  @path
end

#pathsObject (readonly)

Returns the value of attribute paths


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

def paths
  @paths
end

#prefixesObject (readonly)

Returns the value of attribute prefixes


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

def prefixes
  @prefixes
end