aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/template.rb')
-rw-r--r--actionpack/lib/action_view/template.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index f696ea366d..56d740f478 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -37,7 +37,7 @@ module ActionView #:nodoc:
end
def source
- @source ||= File.read(self.filename)
+ @source ||= File.read(@filename)
end
def base_path_for_exception
@@ -71,5 +71,12 @@ module ActionView #:nodoc:
template_type = (@original_path =~ /layouts/i) ? 'layout' : 'template'
raise MissingTemplate, "Missing #{template_type} #{full_template_path} in view path #{display_paths}"
end
+
+ def method_name_path_segment
+ s = File.expand_path(@filename)
+ s.sub!(/^#{Regexp.escape(File.expand_path(RAILS_ROOT))}/, '') if defined?(RAILS_ROOT)
+ s.gsub!(/([^a-zA-Z0-9_])/) { $1.ord }
+ s
+ end
end
end