aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-07-05 16:27:43 -0500
committerJoshua Peek <josh@joshpeek.com>2008-07-05 16:27:43 -0500
commit39ba2da82bcc2f9fad494e6ac0a66a3387ab8ee2 (patch)
tree7a488afe4882b25fc0c5b77b178e52b971130106 /actionpack/lib/action_view/template.rb
parent1dcc59121b9f0c332f6fe93f90fb028ff3448899 (diff)
downloadrails-39ba2da82bcc2f9fad494e6ac0a66a3387ab8ee2.tar.gz
rails-39ba2da82bcc2f9fad494e6ac0a66a3387ab8ee2.tar.bz2
rails-39ba2da82bcc2f9fad494e6ac0a66a3387ab8ee2.zip
Moved complied method name logic into Renderable
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