Avoid to define an initializer after the load_config_initializers

This make the config/initializers run before the railties are loaded
what can break some configurations.
上级 44cfb2ab
......@@ -73,6 +73,14 @@ def self.eager_load!
end
cattr_accessor :test_order # :nodoc:
def self.halt_callback_chains_on_return_false
Callbacks::CallbackChain.halt_and_display_warning_on_return_false
end
def self.halt_callback_chains_on_return_false=(value)
Callbacks::CallbackChain.halt_and_display_warning_on_return_false = value
end
end
autoload :I18n, "active_support/i18n"
......@@ -13,13 +13,6 @@ class Railtie < Rails::Railtie # :nodoc:
end
end
initializer "active_support.halt_callback_chains_on_return_false", after: :load_config_initializers do |app|
if app.config.active_support.key? :halt_callback_chains_on_return_false
ActiveSupport::Callbacks::CallbackChain.halt_and_display_warning_on_return_false = \
app.config.active_support.halt_callback_chains_on_return_false
end
end
# Sets the default value for Time.zone
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
initializer "active_support.initialize_time_zone" do |app|
......
# Be sure to restart your server when you modify this file.
# Do not halt callback chains when a callback returns false.
Rails.application.config.active_support.halt_callback_chains_on_return_false = false
ActiveSupport.halt_callback_chains_on_return_false = false
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册