aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 40d7c11509..81a8299e91 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -287,7 +287,7 @@ module ActionView #:nodoc:
raise ActionViewError, "No #{template_handler_preferences.to_sentence} template found for #{template_path} in #{view_paths.inspect}"
end
template_file_name = full_template_path(template_path, template_extension)
- template_extension = template_extension.gsub(/^\w+\./, '') # strip off any formats
+ template_extension = template_extension.gsub(/^.+\./, '') # strip off any formats
end
else
template_file_name = template_path
@@ -490,7 +490,9 @@ module ActionView #:nodoc:
# Determines the template's file extension, such as rhtml, rxml, or rjs.
def find_template_extension_for(template_path)
- find_template_extension_from_handler(template_path, true) || find_template_extension_from_handler(template_path)
+ find_template_extension_from_handler(template_path, true) ||
+ find_template_extension_from_handler(template_path) ||
+ find_template_extension_from_first_render()
end
def find_template_extension_from_handler(template_path, formatted = nil)
@@ -511,6 +513,12 @@ module ActionView #:nodoc:
end
nil
end
+
+ # Determine the template extension from the <tt>@first_render</tt> filename
+ def find_template_extension_from_first_render
+ extension = @first_render.to_s.sub /^\w+\.?/, ''
+ extension.blank? ? nil : extension
+ end
# This method reads a template file.
def read_template_file(template_path, extension)