From b3a028259f373fd58fea2171a1e9e8b2fe3e253a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 31 Jan 2010 10:24:38 +0100 Subject: Improve missing template error messages a little bit. --- actionpack/lib/action_view/base.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_view/base.rb') diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index af13f2cd3e..07ef3f2140 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -6,15 +6,20 @@ module ActionView #:nodoc: end class MissingTemplate < ActionViewError #:nodoc: - attr_reader :path, :action_name + attr_reader :path - def initialize(paths, path, template_format = nil) + def initialize(paths, path, details, partial) @path = path - @action_name = path.split("/").last.split(".")[0...-1].join(".") - full_template_path = path.include?('.') ? path : "#{path}.erb" display_paths = paths.compact.join(":") - template_type = (path =~ /layouts/i) ? 'layout' : 'template' - super("Missing #{template_type} #{full_template_path} in view path #{display_paths}") + template_type = if partial + "partial" + elsif path =~ /layouts/i + 'layout' + else + 'template' + end + + super("Missing #{template_type} #{path} with #{details.inspect} in view path #{display_paths}") end end -- cgit v1.2.3