method
legacy_connection_handling=
v7.1.3.2 -
Show latest stable
-
0 notes -
Class: ActiveRecord
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
legacy_connection_handling=(_)
public
Hide source
# File activerecord/lib/active_record.rb, line 245 def self.legacy_connection_handling=(_) raise ArgumentError, <<~MSG.squish The `legacy_connection_handling` setter was deprecated in 7.0 and removed in 7.1, but is still defined in your configuration. Please remove this call as it no longer has any effect." MSG end # Sets the async_query_executor for an application. By default the thread pool executor # set to +nil+ which will not run queries in the background. Applications must configure # a thread pool executor to use this feature. Options are: # # * nil - Does not initialize a thread pool executor. Any async calls will be # run in the foreground. # * :global_thread_pool - Initializes a single +Concurrent::ThreadPoolExecutor+ # that uses the +async_query_concurrency+ for the +max_threads+ value. # * :multi_thread_pool - Initializes a +Concurrent::ThreadPoolExecutor+ for each # database connection. The initializer values are defined in the configuration hash. singleton_class.attr_accessor :async_query_executor self.async_query_executor = nil def self.global_thread_pool_async_query_executor # :nodoc: concurrency = global_executor_concurrency || 4 @global_thread_pool_async_query_executor ||= Concurrent::ThreadPoolExecutor.new( min_threads: 0, max_threads: concurrency, max_queue: concurrency * 4, fallback_policy: :caller_runs ) end # Set the +global_executor_concurrency+. This configuration value can only be used # with the global thread pool async query executor. def self.global_executor_concurrency=(global_executor_concurrency) if self.async_query_executor.nil? || self.async_query_executor == :multi_thread_pool raise ArgumentError, "`global_executor_concurrency` cannot be set when using the executor is nil or set to multi_thead_pool. For multiple thread pools, please set the concurrency in your database configuration." end @global_executor_concurrency = global_executor_concurrency end def self.global_executor_concurrency # :nodoc: @global_executor_concurrency ||= nil end singleton_class.attr_accessor :index_nested_attribute_errors self.index_nested_attribute_errors = false ## # :singleton-method: # # Specifies if the methods calling database queries should be logged below # their relevant queries. Defaults to false. singleton_class.attr_accessor :verbose_query_logs self.verbose_query_logs = false ## # :singleton-method: # # Specifies the names of the queues used by background jobs. singleton_class.attr_accessor :queues self.queues = {} singleton_class.attr_accessor :maintain_test_schema self.maintain_test_schema = nil singleton_class.attr_accessor :raise_on_assign_to_attr_readonly self.raise_on_assign_to_attr_readonly = false singleton_class.attr_accessor :belongs_to_required_validates_foreign_key self.belongs_to_required_validates_foreign_key = true singleton_class.attr_accessor :before_committed_on_all_records self.before_committed_on_all_records = false singleton_class.attr_accessor :run_after_transaction_callbacks_in_order_defined self.run_after_transaction_callbacks_in_order_defined = false singleton_class.attr_accessor :commit_transaction_on_non_local_return self.commit_transaction_on_non_local_return = false ## # :singleton-method: # Specify a threshold for the size of query result sets. If the number of # records in the set exceeds the threshold, a warning is logged. This can # be used to identify queries which load thousands of records and # potentially cause memory bloat. singleton_class.attr_accessor :warn_on_records_fetched_greater_than self.warn_on_records_fetched_greater_than = false singleton_class.attr_accessor :application_record_class self.application_record_class = nil ## # :singleton-method: # Set the application to log or raise when an association violates strict loading. # Defaults to :raise. singleton_class.attr_accessor :action_on_strict_loading_violation self.action_on_strict_loading_violation = :raise ## # :singleton-method: # Specifies the format to use when dumping the database schema with Rails' # Rakefile. If :sql, the schema is dumped as (potentially database- # specific) SQL statements. If :ruby, the schema is dumped as an # ActiveRecord::Schema file which can be loaded into any database that # supports migrations. Use :ruby if you want to have different database # adapters for, e.g., your development and test environments. singleton_class.attr_accessor :schema_format self.schema_format = :ruby ## # :singleton-method: # Specifies if an error should be raised if the query has an order being # ignored when doing batch queries. Useful in applications where the # scope being ignored is error-worthy, rather than a warning. singleton_class.attr_accessor :error_on_ignored_order self.error_on_ignored_order = false ## # :singleton-method: # Specify whether or not to use timestamps for migration versions singleton_class.attr_accessor :timestamped_migrations self.timestamped_migrations = true ## # :singleton-method: # Specify strategy to use for executing migrations. singleton_class.attr_accessor :migration_strategy self.migration_strategy = Migration::DefaultStrategy ## # :singleton-method: # Specify whether schema dump should happen at the end of the # bin/rails db:migrate command. This is true by default, which is useful for the # development environment. This should ideally be false in the production # environment where dumping schema is rarely needed. singleton_class.attr_accessor :dump_schema_after_migration self.dump_schema_after_migration = true ## # :singleton-method: # Specifies which database schemas to dump when calling db:schema:dump. # If the value is :schema_search_path (the default), any schemas listed in # schema_search_path are dumped. Use :all to dump all schemas regardless # of schema_search_path, or a string of comma separated schemas for a # custom list. singleton_class.attr_accessor :dump_schemas self.dump_schemas = :schema_search_path def self.suppress_multiple_database_warning ActiveRecord.deprecator.warn(<<-MSG.squish) config.active_record.suppress_multiple_database_warning is deprecated and will be removed in Rails 7.2. It no longer has any effect and should be removed from the configuration file. MSG end def self.suppress_multiple_database_warning=(value) ActiveRecord.deprecator.warn(<<-MSG.squish) config.active_record.suppress_multiple_database_warning= is deprecated and will be removed in Rails 7.2. It no longer has any effect and should be removed from the configuration file. MSG end ## # :singleton-method: # If true, Rails will verify all foreign keys in the database after loading fixtures. # An error will be raised if there are any foreign key violations, indicating incorrectly # written fixtures. # Supported by PostgreSQL and SQLite. singleton_class.attr_accessor :verify_foreign_keys_for_fixtures self.verify_foreign_keys_for_fixtures = false ## # :singleton-method: # If true, Rails will continue allowing plural association names in where clauses on singular associations # This behavior will be removed in Rails 7.2. singleton_class.attr_accessor :allow_deprecated_singular_associations_name self.allow_deprecated_singular_associations_name = true singleton_class.attr_accessor :query_transformers self.query_transformers = [] ## # :singleton-method: # Application configurable boolean that instructs the YAML Coder to use # an unsafe load if set to true. singleton_class.attr_accessor :use_yaml_unsafe_load self.use_yaml_unsafe_load = false ## # :singleton-method: # Application configurable boolean that denotes whether or not to raise # an exception when the PostgreSQLAdapter is provided with an integer that # is wider than signed 64bit representation singleton_class.attr_accessor :raise_int_wider_than_64bit self.raise_int_wider_than_64bit = true ## # :singleton-method: # Application configurable array that provides additional permitted classes # to Psych safe_load in the YAML Coder singleton_class.attr_accessor :yaml_column_permitted_classes self.yaml_column_permitted_classes = [Symbol] ## # :singleton-method: # Controls when to generate a value for <tt>has_secure_token</tt> # declarations. Defaults to <tt>:create</tt>. singleton_class.attr_accessor :generate_secure_token_on self.generate_secure_token_on = :create def self.marshalling_format_version Marshalling.format_version end def self.marshalling_format_version=(value) Marshalling.format_version = value end def self.eager_load! super ActiveRecord::Locking.eager_load! ActiveRecord::Scoping.eager_load! ActiveRecord::Associations.eager_load! ActiveRecord::AttributeMethods.eager_load! ActiveRecord::ConnectionAdapters.eager_load! ActiveRecord::Encryption.eager_load! end # Explicitly closes all database connections in all pools. def self.disconnect_all! ConnectionAdapters::PoolConfig.disconnect_all! end end ActiveSupport.on_load(:active_record) do Arel::Table.engine = self end ActiveSupport.on_load(:i18n) do I18n.load_path << File.expand_path("active_record/locale/en.yml", __dir__) end YAML.load_tags["!ruby/object:ActiveRecord::AttributeSet"] = "ActiveModel::AttributeSet" YAML.load_tags["!ruby/object:ActiveRecord::Attribute::FromDatabase"] = "ActiveModel::Attribute::FromDatabase" YAML.load_tags["!ruby/object:ActiveRecord::LazyAttributeHash"] = "ActiveModel::LazyAttributeHash" YAML.load_tags["!ruby/object:ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString"] = "ActiveRecord::Type::String"