diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-16 02:51:19 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-16 02:51:19 +0000 |
commit | 7d06259be9b1b20816dd3502a0fd6f311ef6b24b (patch) | |
tree | 97803d5d9d0c493be6454ec873484ca0cdd322ce /actionpack/lib | |
parent | 500c7349353e8161dee6c96935a87137e9e78e1d (diff) | |
download | rails-7d06259be9b1b20816dd3502a0fd6f311ef6b24b.tar.gz rails-7d06259be9b1b20816dd3502a0fd6f311ef6b24b.tar.bz2 rails-7d06259be9b1b20816dd3502a0fd6f311ef6b24b.zip |
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
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 9 |
1 files changed, 7 insertions, 2 deletions
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) |