From 7d06259be9b1b20816dd3502a0fd6f311ef6b24b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 16 Mar 2006 02:51:19 +0000 Subject: Dots in template path should not trip up rendering (closes #4244) [lmarlow@yahoo.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3884 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/base.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 94e7a47232..b118ee1042 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -221,7 +221,7 @@ module ActionView #:nodoc: @first_render = template_path if @first_render.nil? if use_full_path - template_path_without_extension, template_extension = template_path.split('.') + template_path_without_extension, template_extension = path_and_extension(template_path) if template_extension template_file_name = full_template_path(template_path_without_extension, template_extension) @@ -335,7 +335,7 @@ module ActionView #:nodoc: end def file_exists?(template_path)#:nodoc: - template_file_name, template_file_extension = template_path.split(".") + template_file_name, template_file_extension = path_and_extension(template_path) if template_file_extension template_exists?(template_file_name, template_file_extension) @@ -361,6 +361,11 @@ module ActionView #:nodoc: @@method_names.has_key?(file_path) || FileTest.exists?(file_path) end + def path_and_extension(template_path) + template_path_without_extension = template_path.sub(/\.(\w+)$/, '') + [ template_path_without_extension, $1 ] + end + # This method reads a template file. def read_template_file(template_path, extension) File.read(template_path) -- cgit v1.2.3