diff options
author | Claudio Poli <masterkain@gmail.com> | 2008-09-20 22:57:45 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-09-20 22:57:45 -0500 |
commit | 5f83e1844c83c19cf97c6415b943c6ec3cb4bb06 (patch) | |
tree | ce3552974bf06f82e0b8fb0b8edddd65be18af82 /actionpack/lib/action_view/template.rb | |
parent | de96a8666d8edc9be57f6146e587a71d23dbeb41 (diff) | |
download | rails-5f83e1844c83c19cf97c6415b943c6ec3cb4bb06.tar.gz rails-5f83e1844c83c19cf97c6415b943c6ec3cb4bb06.tar.bz2 rails-5f83e1844c83c19cf97c6415b943c6ec3cb4bb06.zip |
Fixed missing template paths on exception [#1082 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_view/template.rb')
-rw-r--r-- | actionpack/lib/action_view/template.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index 64597b3d39..12808581a3 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -52,15 +52,20 @@ module ActionView #:nodoc: end memoize :path_without_format_and_extension + def relative_path + path = File.expand_path(filename) + path.sub!(/^#{Regexp.escape(File.expand_path(RAILS_ROOT))}\//, '') if defined?(RAILS_ROOT) + path + end + memoize :relative_path + def source File.read(filename) end memoize :source def method_segment - segment = File.expand_path(filename) - segment.sub!(/^#{Regexp.escape(File.expand_path(RAILS_ROOT))}/, '') if defined?(RAILS_ROOT) - segment.gsub!(/([^a-zA-Z0-9_])/) { $1.ord } + relative_path.to_s.gsub(/([^a-zA-Z0-9_])/) { $1.ord } end memoize :method_segment @@ -69,7 +74,7 @@ module ActionView #:nodoc: rescue Exception => e raise e unless filename if TemplateError === e - e.sub_template_of(filename) + e.sub_template_of(self) raise e else raise TemplateError.new(self, view.assigns, e) |