mirror of https://github.com/rails/rails
Deprecate handler_class_for_extension as template handlers can be any Ruby object, not necessarily a class.
This commit is contained in:
parent
831a2342c6
commit
ba63c0a9b5
|
@ -45,7 +45,7 @@ module ActionView
|
|||
elsif options.key?(:file)
|
||||
with_fallbacks { find_template(options[:file], options[:prefix], false, keys) }
|
||||
elsif options.key?(:inline)
|
||||
handler = Template.handler_class_for_extension(options[:type] || "erb")
|
||||
handler = Template.handler_for_extension(options[:type] || "erb")
|
||||
Template.new(options[:inline], "inline template", handler, :locals => keys)
|
||||
elsif options.key?(:template)
|
||||
options[:template].respond_to?(:render) ?
|
||||
|
|
|
@ -44,7 +44,13 @@ module ActionView #:nodoc:
|
|||
end
|
||||
|
||||
def handler_class_for_extension(extension)
|
||||
(extension && registered_template_handler(extension.to_sym)) || @@default_template_handlers
|
||||
ActiveSupport::Deprecation.warn "handler_class_for_extension is deprecated. " <<
|
||||
"Please use handler_for_extension instead", caller
|
||||
handler_for_extension(extension)
|
||||
end
|
||||
|
||||
def handler_for_extension(extension)
|
||||
registered_template_handler(extension) || @@default_template_handlers
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -129,7 +129,7 @@ module ActionView
|
|||
def extract_handler_and_format(path, default_formats)
|
||||
pieces = File.basename(path).split(".")
|
||||
pieces.shift
|
||||
handler = Template.handler_class_for_extension(pieces.pop)
|
||||
handler = Template.handler_for_extension(pieces.pop)
|
||||
format = pieces.last && Mime[pieces.last]
|
||||
[handler, format]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue