Fix arity warning for template handlers

Mainly to help with knowning which template is reponsible for the
warning.

handler.class # => Class

handler.to_s # => Coffee::Rails::TemplateHandler

Before:

Change:
  >> Class#call(template)
To:
  >> Class#call(template, source)

After:

Change:
  >> Coffee::Rails::TemplateHandler.call(template)
To:
  >> Coffee::Rails::TemplateHandler.call(template, source)
This commit is contained in:
localhostdotdev 2019-04-04 18:59:33 +02:00
parent dc45130c44
commit b2b2f70f1f
1 changed files with 3 additions and 3 deletions

View File

@ -45,12 +45,12 @@ module ActionView #:nodoc:
unless params.find_all { |type, _| type == :req || type == :opt }.length >= 2
ActiveSupport::Deprecation.warn <<~eowarn
Single arity template handlers are deprecated. Template handlers must
Single arity template handlers are deprecated. Template handlers must
now accept two parameters, the view object and the source for the view object.
Change:
>> #{handler.class}#call(#{params.map(&:last).join(", ")})
>> #{handler}.call(#{params.map(&:last).join(", ")})
To:
>> #{handler.class}#call(#{params.map(&:last).join(", ")}, source)
>> #{handler}.call(#{params.map(&:last).join(", ")}, source)
eowarn
handler = LegacyHandlerWrapper.new(handler)
end