1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove deprecated support to pass an object that is not a ActionView::LookupContext as the first argument in ActionView::Base#initialize

This commit is contained in:
Rafael Mendonça França 2020-05-06 16:28:34 -04:00
parent c3b08725a1
commit 05f234dbbd
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
4 changed files with 10 additions and 40 deletions

View file

@ -1,3 +1,8 @@
* Remove deprecated support to pass an object that is not a `ActionView::LookupContext` as the first argument
in `ActionView::Base#initialize`.
*Rafael Mendonça França*
* Remove deprecated `format` argument `ActionView::Base#initialize`.
*Rafael Mendonça França*

View file

@ -213,21 +213,6 @@ module ActionView #:nodoc:
# :stopdoc:
def self.build_lookup_context(context)
case context
when ActionView::Renderer
context.lookup_context
when Array
ActionView::LookupContext.new(context)
when ActionView::PathSet
ActionView::LookupContext.new(context)
when nil
ActionView::LookupContext.new([])
else
raise NotImplementedError, context.class.name
end
end
def self.empty
with_view_paths([])
end
@ -242,19 +227,10 @@ module ActionView #:nodoc:
# :startdoc:
def initialize(lookup_context = nil, assigns = {}, controller = nil) #:nodoc:
def initialize(lookup_context, assigns = {}, controller = nil) #:nodoc:
@_config = ActiveSupport::InheritableOptions.new
case lookup_context
when ActionView::LookupContext
@lookup_context = lookup_context
else
ActiveSupport::Deprecation.warn <<~eowarn.squish
ActionView::Base instances should be constructed with a lookup context,
assignments, and a controller.
eowarn
@lookup_context = self.class.build_lookup_context(lookup_context)
end
@lookup_context = lookup_context
@view_renderer = ActionView::Renderer.new @lookup_context
@current_template = nil

View file

@ -378,20 +378,6 @@ module RenderTestCases
assert_equal "Hello: davidHello: mary", @view.render(partial: "test/customer", collection: customers)
end
def test_deprecated_constructor
assert_deprecated do
ActionView::Base.new
end
assert_deprecated do
ActionView::Base.new ["/a"]
end
assert_deprecated do
ActionView::Base.new ActionView::PathSet.new ["/a"]
end
end
def test_without_compiled_method_container_is_deprecated
view = ActionView::Base.with_view_paths(ActionController::Base.view_paths)
assert_deprecated("ActionView::Base instances must implement `compiled_method_container`") do

View file

@ -55,6 +55,9 @@ Please refer to the [Changelog][action-pack] for detailed changes.
### Removals
* Remove deprecated support to pass an object that is not a `ActionView::LookupContext` as the first argument
in `ActionView::Base#initialize`.
* Remove deprecated `format` argument `ActionView::Base#initialize`.
* Remove deprecated `ActionView::Template#refresh`.