From ec432122069501bd84fb99c017dfe42c194e96fc Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 29 Jun 2006 20:52:00 +0000 Subject: r4732@asus: jeremy | 2006-06-29 13:51:32 -0700 Chop RAILS_ROOT from file path for readability. Preserve non-alphanumeric characters for uniqueness. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4514 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/base.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 1aba054e6d..8f53230024 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -474,7 +474,10 @@ module ActionView #:nodoc: def compiled_method_name_file_path_segment(file_name) if file_name - File.expand_path(file_name).gsub(/[^a-zA-Z0-9_]/, '_') + s = File.expand_path(file_name) + s.sub!(/^#{Regexp.escape(File.expand_path(RAILS_ROOT))}/, '') if defined?(RAILS_ROOT) + s.gsub!(/([^a-zA-Z0-9_])/) { $1[0].to_s } + s else (@@inline_template_count += 1).to_s end -- cgit v1.2.3