aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb5
1 files changed, 4 insertions, 1 deletions
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