diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index 4522a8ec06a74..06a0e8fa496b6 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -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* diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index fdcf9f76ac20e..9a43e898e7440 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -213,21 +213,6 @@ def assign(new_assigns) # :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 @@ def self.with_context(context, assigns = {}, controller = nil) # :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 diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 76bc7dc1684fb..30219fc84e6eb 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -378,20 +378,6 @@ def test_render_partial_collection_for_non_array 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 diff --git a/guides/source/6_1_release_notes.md b/guides/source/6_1_release_notes.md index bec9b22003c9d..e9e533d043aa6 100644 --- a/guides/source/6_1_release_notes.md +++ b/guides/source/6_1_release_notes.md @@ -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`.