diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index b8a5d39b20..1cd8c05225 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -5,7 +5,7 @@ module ActionView #:nodoc: class MissingTemplate < ActionViewError #:nodoc: def initialize(paths, path, template_format = nil) full_template_path = path.include?('.') ? path : "#{path}.erb" - display_paths = paths.join(':') + display_paths = paths.compact.join(":") template_type = (path =~ /layouts/i) ? 'layout' : 'template' super("Missing #{template_type} #{full_template_path} in view path #{display_paths}") end diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index ecb6103ade..9c8b8ade1e 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -41,7 +41,7 @@ module ActionView #:nodoc: class Path #:nodoc: attr_reader :path, :paths - delegate :to_s, :to_str, :hash, :inspect, :to => :path + delegate :hash, :inspect, :to => :path def initialize(path, load = false) raise ArgumentError, "path already is a Path class" if path.is_a?(Path) @@ -49,6 +49,14 @@ module ActionView #:nodoc: reload! if load end + def to_s + if defined?(RAILS_ROOT) + path.to_s.sub(/^#{Regexp.escape(File.expand_path(RAILS_ROOT))}\//, '') + else + path.to_s + end + end + def ==(path) to_str == path.to_str end |