aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r--actionpack/lib/action_view/base.rb9
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)