mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Get rid of the unused ActiveRecord::Base.sqlite3_production_warning
This commit is contained in:
parent
40f6bd0eb9
commit
a50ff734cb
3 changed files with 11 additions and 20 deletions
|
@ -138,8 +138,6 @@ module ActiveRecord
|
|||
|
||||
class_attribute :has_many_inversing, instance_accessor: false, default: false
|
||||
|
||||
mattr_accessor :sqlite3_production_warning, instance_accessor: false, default: true
|
||||
|
||||
class_attribute :default_connection_handler, instance_writer: false
|
||||
|
||||
class_attribute :default_role, instance_writer: false
|
||||
|
|
|
@ -198,6 +198,17 @@ To keep using the current cache store, you can turn off cache versioning entirel
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
SQLITE3_PRODUCTION_WARN = "You are running SQLite in production, this is generally not recommended."\
|
||||
" You can disable this warning by setting \"config.active_record.sqlite3_production_warning=false\"."
|
||||
initializer "active_record.sqlite3_production_warning" do
|
||||
if config.active_record.delete(:sqlite3_production_warning) && Rails.env.production?
|
||||
ActiveSupport.on_load(:active_record_sqlite3adapter) do
|
||||
Rails.logger.warn(SQLITE3_PRODUCTION_WARN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initializer "active_record.set_configs" do |app|
|
||||
configs = app.config.active_record
|
||||
|
||||
|
@ -232,16 +243,6 @@ To keep using the current cache store, you can turn off cache versioning entirel
|
|||
end
|
||||
end
|
||||
|
||||
SQLITE3_PRODUCTION_WARN = "You are running SQLite in production, this is generally not recommended."\
|
||||
" You can disable this warning by setting \"config.active_record.sqlite3_production_warning=false\"."
|
||||
initializer "active_record.sqlite3_production_warning" do
|
||||
if config.active_record.sqlite3_production_warning && Rails.env.production?
|
||||
ActiveSupport.on_load(:active_record_sqlite3adapter) do
|
||||
Rails.logger.warn(SQLITE3_PRODUCTION_WARN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Expose database runtime to controller for logging.
|
||||
initializer "active_record.log_runtime" do
|
||||
require "active_record/railties/controller_runtime"
|
||||
|
|
|
@ -3142,14 +3142,6 @@ module ApplicationTests
|
|||
assert_equal false, ActionDispatch::Request.return_only_media_type_on_content_type
|
||||
end
|
||||
|
||||
test "config.active_record.sqlite3_production_warning is on by default for new apps" do
|
||||
restore_sqlite3_warning
|
||||
|
||||
app "development"
|
||||
|
||||
assert_equal true, ActiveRecord::Base.sqlite3_production_warning
|
||||
end
|
||||
|
||||
test "logs a warning when running SQLite3 in production" do
|
||||
restore_sqlite3_warning
|
||||
app_file "config/initializers/active_record.rb", <<~RUBY
|
||||
|
|
Loading…
Reference in a new issue