aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-06-29 20:52:00 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-06-29 20:52:00 +0000
commitec432122069501bd84fb99c017dfe42c194e96fc (patch)
tree456f11faa04f001a2300bb98ad478e2d10c6d351 /actionpack/lib/action_view
parentf3aa7c1e64b2f872215f860cecbe7feca3e793d7 (diff)
downloadrails-ec432122069501bd84fb99c017dfe42c194e96fc.tar.gz
rails-ec432122069501bd84fb99c017dfe42c194e96fc.tar.bz2
rails-ec432122069501bd84fb99c017dfe42c194e96fc.zip
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
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