diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index 88ee07d95bb2a576e34643c8111d4cf063979e1f..9d1e0d3ac56a59cb0bd682351bc0b186c22cfb3d 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -204,7 +204,7 @@ def load! private def valid_extension?(extension) - Template.template_handler_extensions.include?(extension) + !Template.registered_template_handler(extension).nil? end def find_full_path(path, load_paths) diff --git a/actionpack/lib/action_view/template_handlers.rb b/actionpack/lib/action_view/template_handlers.rb index d06ddd5fb55632d692d714eaa4425b8f3817680c..205f8628f0e97e791e24639822342c6470dc2917 100644 --- a/actionpack/lib/action_view/template_handlers.rb +++ b/actionpack/lib/action_view/template_handlers.rb @@ -32,13 +32,17 @@ def template_handler_extensions @@template_handlers.keys.map(&:to_s).sort end + def registered_template_handler(extension) + extension && @@template_handlers[extension.to_sym] + end + def register_default_template_handler(extension, klass) register_template_handler(extension, klass) @@default_template_handlers = klass end def handler_class_for_extension(extension) - (extension && @@template_handlers[extension.to_sym]) || @@default_template_handlers + registered_template_handler(extension) || @@default_template_handlers end end end