aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/paths.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-12-05 11:24:28 -0600
committerJoshua Peek <josh@joshpeek.com>2008-12-05 11:24:28 -0600
commit731dcd84048ef259684cc8005101f65d1941e495 (patch)
tree02b05367d813fccc777885faa06600a355532ba9 /actionpack/lib/action_view/paths.rb
parent9c9da6c892d715ca22c3cf51f50deb1d80029c66 (diff)
downloadrails-731dcd84048ef259684cc8005101f65d1941e495.tar.gz
rails-731dcd84048ef259684cc8005101f65d1941e495.tar.bz2
rails-731dcd84048ef259684cc8005101f65d1941e495.zip
Silence server backtrace in rescue templates and log files. Also remove some noise from missing template errors.
Diffstat (limited to 'actionpack/lib/action_view/paths.rb')
-rw-r--r--actionpack/lib/action_view/paths.rb10
1 files changed, 9 insertions, 1 deletions
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