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

Deprecate finalizer configuration (it doesn't do anything)

Revert "Remove finalizer and configuration"

This reverts commit 9e7b4a3173788ea43b11e74a4d2f69a5f1565daa.
This commit is contained in:
Aaron Patterson 2019-01-24 13:50:24 -08:00
parent 8fc73067e3
commit 7761ddbebb
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6
4 changed files with 49 additions and 0 deletions

View file

@ -1,3 +1,9 @@
* ActionView::Template.finalize_compiled_template_methods is deprecated with
no replacement.
* config.action_view.finalize_compiled_template_methods is deprecated with
no replacement.
* Ensure unique DOM IDs for collection inputs with float values.
Fixes #34974

View file

@ -6,10 +6,13 @@ require "rails"
module ActionView
# = Action View Railtie
class Railtie < Rails::Engine # :nodoc:
NULL_OPTION = Object.new
config.action_view = ActiveSupport::OrderedOptions.new
config.action_view.embed_authenticity_token_in_remote_forms = nil
config.action_view.debug_missing_translation = true
config.action_view.default_enforce_utf8 = nil
config.action_view.finalize_compiled_template_methods = NULL_OPTION
config.eager_load_namespaces << ActionView
@ -45,6 +48,16 @@ module ActionView
end
end
initializer "action_view.finalize_compiled_template_methods" do |app|
ActiveSupport.on_load(:action_view) do
option = app.config.action_view.delete(:finalize_compiled_template_methods)
if option != NULL_OPTION
ActiveSupport::Deprecation.warn "action_view.finalize_compiled_template_methods is deprecated and has no effect"
end
end
end
initializer "action_view.logger" do
ActiveSupport.on_load(:action_view) { self.logger ||= Rails.logger }
end

View file

@ -2,6 +2,7 @@
require "active_support/core_ext/object/try"
require "active_support/core_ext/kernel/singleton_class"
require "active_support/deprecation"
require "thread"
require "delegate"
@ -10,6 +11,14 @@ module ActionView
class Template
extend ActiveSupport::Autoload
def self.finalize_compiled_template_methods
ActiveSupport::Deprecation.warn "ActionView::Template.finalize_compiled_template_methods is deprecated and has no effect"
end
def self.finalize_compiled_template_methods=(_)
ActiveSupport::Deprecation.warn "ActionView::Template.finalize_compiled_template_methods= is deprecated and has no effect"
end
# === Encodings in ActionView::Template
#
# ActionView::Template is one of a few sources of potential

View file

@ -2092,6 +2092,27 @@ module ApplicationTests
assert_equal true, ActionView::Helpers::FormTagHelper.default_enforce_utf8
end
test "ActionView::Template.finalize_compiled_template_methods is true by default" do
app "test"
assert_deprecated do
ActionView::Template.finalize_compiled_template_methods
end
end
test "ActionView::Template.finalize_compiled_template_methods can be configured via config.action_view.finalize_compiled_template_methods" do
app_file "config/environments/test.rb", <<-RUBY
Rails.application.configure do
config.action_view.finalize_compiled_template_methods = false
end
RUBY
app "test"
assert_deprecated do
ActionView::Template.finalize_compiled_template_methods
end
end
test "ActiveJob::Base.return_false_on_aborted_enqueue is true by default" do
app "development"