Require that `ActionView::Base` subclasses implement `#compiled_method_container`

This commit is contained in:
Rafael Mendonça França 2020-05-06 17:31:39 -04:00
parent cd0c99c991
commit 469c4ccad7
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
4 changed files with 12 additions and 10 deletions

View File

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

View File

@ -250,15 +250,11 @@ module ActionView #:nodoc:
end
def compiled_method_container
if self.class == ActionView::Base
ActiveSupport::Deprecation.warn <<~eowarn.squish
ActionView::Base instances must implement `compiled_method_container`
or use the class method `with_empty_template_cache` for constructing
an ActionView::Base instance that has an empty cache.
eowarn
end
self.class
raise NotImplementedError, <<~msg.squish
Subclasses of ActionView::Base must implement `compiled_method_container`
or use the class method `with_empty_template_cache` for constructing
an ActionView::Base subclass that has an empty cache.
msg
end
def in_rendering_context(options)

View File

@ -380,7 +380,7 @@ module RenderTestCases
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
assert_raises(NotImplementedError) do
assert_equal "Hello world!", view.render(template: "test/hello_world")
end
end

View File

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