123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord

Relationships & Source Files
Namespace Children
Modules:
Classes:
Exceptions:
ActiveRecordError, AdapterError, AdapterNotFound, AdapterNotSpecified, AdapterTimeout, AmbiguousSourceReflectionForThroughAssociation, AssociationNotFoundError, AssociationTypeMismatch, AsynchronousQueryInsideTransactionError, AttributeAssignmentError, CompositePrimaryKeyMismatchError, ConcurrentMigrationError, ConfigurationError, ConnectionFailed, ConnectionNotDefined, ConnectionNotEstablished, ConnectionTimeoutError, DangerousAttributeError, DatabaseAlreadyExists, DatabaseConnectionError, DatabaseVersionError, Deadlocked, DeleteRestrictionError, DestroyAssociationAsyncError, DuplicateMigrationNameError, DuplicateMigrationVersionError, EagerLoadPolymorphicError, EnvironmentMismatchError, EnvironmentStorageError, ExclusiveConnectionTimeoutError, FixtureClassNotFound, HasManyThroughAssociationNotFoundError, HasManyThroughAssociationPointlessSourceTypeError, HasManyThroughAssociationPolymorphicSourceError, HasManyThroughAssociationPolymorphicThroughError, HasManyThroughCantAssociateThroughHasOneOrManyReflection, HasManyThroughNestedAssociationsAreReadonly, HasManyThroughOrderError, HasManyThroughSourceAssociationNotFoundError, HasOneAssociationPolymorphicThroughError, HasOneThroughCantAssociateThroughCollection, HasOneThroughCantAssociateThroughHasOneOrManyReflection, HasOneThroughNestedAssociationsAreReadonly, IllegalMigrationNameError, InvalidForeignKey, InvalidMigrationTimestampError, InverseOfAssociationNotFoundError, InverseOfAssociationRecursiveError, IrreversibleMigration, IrreversibleOrderError, LockWaitTimeout, MigrationError, MismatchedForeignKey, MultiparameterAssignmentErrors, NoDatabaseError, NoEnvironmentInSchemaError, NotNullViolation, PendingMigrationError, PreparedStatementCacheExpired, PreparedStatementInvalid, ProtectedEnvironmentError, QueryAborted, QueryCanceled, RangeError, ReadOnlyError, ReadOnlyRecord, ReadonlyAttributeError, RecordInvalid, RecordNotDestroyed, RecordNotFound, RecordNotSaved, RecordNotUnique, Rollback, SQLWarning, SerializationFailure, SerializationTypeMismatch, SoleRecordExceeded, StaleObjectError, StatementInvalid, StatementTimeout, StrictLoadingViolationError, SubclassNotFound, TableNotSpecified, ThroughCantAssociateThroughHasOneOrManyReflection, ThroughNestedAssociationsAreReadonly, TransactionIsolationError, TransactionRollbackError, TypeConflictError, UnknownAttributeReference, UnknownMigrationVersionError, UnknownPrimaryKey, UnmodifiableRelation, ValueTooLong, WrappedDatabaseException
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Defined in: activerecord/lib/active_record.rb,
activerecord/lib/active_record/aggregations.rb,
activerecord/lib/active_record/association_relation.rb,
activerecord/lib/active_record/associations.rb,
activerecord/lib/active_record/asynchronous_queries_tracker.rb,
activerecord/lib/active_record/attribute_assignment.rb,
activerecord/lib/active_record/attribute_methods.rb,
activerecord/lib/active_record/attributes.rb,
activerecord/lib/active_record/autosave_association.rb,
activerecord/lib/active_record/base.rb,
activerecord/lib/active_record/callbacks.rb,
activerecord/lib/active_record/connection_adapters.rb,
activerecord/lib/active_record/connection_handling.rb,
activerecord/lib/active_record/core.rb,
activerecord/lib/active_record/counter_cache.rb,
activerecord/lib/active_record/database_configurations.rb,
activerecord/lib/active_record/delegated_type.rb,
activerecord/lib/active_record/deprecator.rb,
activerecord/lib/active_record/destroy_association_async_job.rb,
activerecord/lib/active_record/disable_joins_association_relation.rb,
activerecord/lib/active_record/dynamic_matchers.rb,
activerecord/lib/active_record/encryption.rb,
activerecord/lib/active_record/enum.rb,
activerecord/lib/active_record/errors.rb,
activerecord/lib/active_record/explain.rb,
activerecord/lib/active_record/explain_registry.rb,
activerecord/lib/active_record/explain_subscriber.rb,
activerecord/lib/active_record/fixtures.rb,
activerecord/lib/active_record/future_result.rb,
activerecord/lib/active_record/gem_version.rb,
activerecord/lib/active_record/inheritance.rb,
activerecord/lib/active_record/insert_all.rb,
activerecord/lib/active_record/integration.rb,
activerecord/lib/active_record/internal_metadata.rb,
activerecord/lib/active_record/legacy_yaml_adapter.rb,
activerecord/lib/active_record/log_subscriber.rb,
activerecord/lib/active_record/marshalling.rb,
activerecord/lib/active_record/message_pack.rb,
activerecord/lib/active_record/migration.rb,
activerecord/lib/active_record/model_schema.rb,
activerecord/lib/active_record/nested_attributes.rb,
activerecord/lib/active_record/no_touching.rb,
activerecord/lib/active_record/persistence.rb,
activerecord/lib/active_record/promise.rb,
activerecord/lib/active_record/query_cache.rb,
activerecord/lib/active_record/query_logs.rb,
activerecord/lib/active_record/query_logs_formatter.rb,
activerecord/lib/active_record/querying.rb,
activerecord/lib/active_record/railtie.rb,
activerecord/lib/active_record/readonly_attributes.rb,
activerecord/lib/active_record/reflection.rb,
activerecord/lib/active_record/relation.rb,
activerecord/lib/active_record/result.rb,
activerecord/lib/active_record/runtime_registry.rb,
activerecord/lib/active_record/sanitization.rb,
activerecord/lib/active_record/schema.rb,
activerecord/lib/active_record/schema_dumper.rb,
activerecord/lib/active_record/schema_migration.rb,
activerecord/lib/active_record/scoping.rb,
activerecord/lib/active_record/secure_password.rb,
activerecord/lib/active_record/secure_token.rb,
activerecord/lib/active_record/serialization.rb,
activerecord/lib/active_record/signed_id.rb,
activerecord/lib/active_record/statement_cache.rb,
activerecord/lib/active_record/store.rb,
activerecord/lib/active_record/suppressor.rb,
activerecord/lib/active_record/table_metadata.rb,
activerecord/lib/active_record/test_databases.rb,
activerecord/lib/active_record/test_fixtures.rb,
activerecord/lib/active_record/timestamp.rb,
activerecord/lib/active_record/token_for.rb,
activerecord/lib/active_record/touch_later.rb,
activerecord/lib/active_record/transaction.rb,
activerecord/lib/active_record/transactions.rb,
activerecord/lib/active_record/translation.rb,
activerecord/lib/active_record/type.rb,
activerecord/lib/active_record/type_caster.rb,
activerecord/lib/active_record/validations.rb,
activerecord/lib/active_record/version.rb,
activerecord/lib/active_record/associations/alias_tracker.rb,
activerecord/lib/active_record/associations/association.rb,
activerecord/lib/active_record/associations/association_scope.rb,
activerecord/lib/active_record/associations/belongs_to_association.rb,
activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb,
activerecord/lib/active_record/associations/collection_association.rb,
activerecord/lib/active_record/associations/collection_proxy.rb,
activerecord/lib/active_record/associations/disable_joins_association_scope.rb,
activerecord/lib/active_record/associations/errors.rb,
activerecord/lib/active_record/associations/has_many_association.rb,
activerecord/lib/active_record/associations/has_many_through_association.rb,
activerecord/lib/active_record/associations/has_one_association.rb,
activerecord/lib/active_record/associations/has_one_through_association.rb,
activerecord/lib/active_record/associations/join_dependency.rb,
activerecord/lib/active_record/associations/nested_error.rb,
activerecord/lib/active_record/associations/preloader.rb,
activerecord/lib/active_record/associations/singular_association.rb,
activerecord/lib/active_record/associations/through_association.rb,
activerecord/lib/active_record/associations/join_dependency/join_association.rb,
activerecord/lib/active_record/associations/join_dependency/join_base.rb,
activerecord/lib/active_record/associations/join_dependency/join_part.rb,
activerecord/lib/active_record/associations/preloader/association.rb,
activerecord/lib/active_record/associations/preloader/batch.rb,
activerecord/lib/active_record/associations/preloader/branch.rb,
activerecord/lib/active_record/associations/preloader/through_association.rb,
activerecord/lib/active_record/attribute_methods/before_type_cast.rb,
activerecord/lib/active_record/attribute_methods/composite_primary_key.rb,
activerecord/lib/active_record/attribute_methods/dirty.rb,
activerecord/lib/active_record/attribute_methods/primary_key.rb,
activerecord/lib/active_record/attribute_methods/query.rb,
activerecord/lib/active_record/attribute_methods/read.rb,
activerecord/lib/active_record/attribute_methods/serialization.rb,
activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb,
activerecord/lib/active_record/attribute_methods/write.rb,
activerecord/lib/active_record/coders/column_serializer.rb,
activerecord/lib/active_record/coders/json.rb,
activerecord/lib/active_record/coders/yaml_column.rb,
activerecord/lib/active_record/connection_adapters/abstract_adapter.rb,
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb,
activerecord/lib/active_record/connection_adapters/column.rb,
activerecord/lib/active_record/connection_adapters/deduplicable.rb,
activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb,
activerecord/lib/active_record/connection_adapters/pool_config.rb,
activerecord/lib/active_record/connection_adapters/pool_manager.rb,
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb,
activerecord/lib/active_record/connection_adapters/schema_cache.rb,
activerecord/lib/active_record/connection_adapters/sql_type_metadata.rb,
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb,
activerecord/lib/active_record/connection_adapters/statement_pool.rb,
activerecord/lib/active_record/connection_adapters/trilogy_adapter.rb,
activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb,
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb,
activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb,
activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb,
activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb,
activerecord/lib/active_record/connection_adapters/abstract/quoting.rb,
activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb,
activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb,
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb,
activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb,
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb,
activerecord/lib/active_record/connection_adapters/abstract/transaction.rb,
activerecord/lib/active_record/connection_adapters/abstract/connection_pool/queue.rb,
activerecord/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb,
activerecord/lib/active_record/connection_adapters/mysql/column.rb,
activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb,
activerecord/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb,
activerecord/lib/active_record/connection_adapters/mysql/quoting.rb,
activerecord/lib/active_record/connection_adapters/mysql/schema_creation.rb,
activerecord/lib/active_record/connection_adapters/mysql/schema_definitions.rb,
activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb,
activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb,
activerecord/lib/active_record/connection_adapters/mysql/type_metadata.rb,
activerecord/lib/active_record/connection_adapters/mysql2/database_statements.rb,
activerecord/lib/active_record/connection_adapters/postgresql/column.rb,
activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb,
activerecord/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid.rb,
activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb,
activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb,
activerecord/lib/active_record/connection_adapters/postgresql/schema_creation.rb,
activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb,
activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb,
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb,
activerecord/lib/active_record/connection_adapters/postgresql/type_metadata.rb,
activerecord/lib/active_record/connection_adapters/postgresql/utils.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/date.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/macaddr.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/oid.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/timestamp_with_time_zone.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb,
activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/column.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/database_statements.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/quoting.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/schema_creation.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb,
activerecord/lib/active_record/connection_adapters/sqlite3/schema_statements.rb,
activerecord/lib/active_record/connection_adapters/trilogy/database_statements.rb,
activerecord/lib/active_record/database_configurations/connection_url_resolver.rb,
activerecord/lib/active_record/database_configurations/database_config.rb,
activerecord/lib/active_record/database_configurations/hash_config.rb,
activerecord/lib/active_record/database_configurations/url_config.rb,
activerecord/lib/active_record/encryption/auto_filtered_parameters.rb,
activerecord/lib/active_record/encryption/cipher.rb,
activerecord/lib/active_record/encryption/config.rb,
activerecord/lib/active_record/encryption/configurable.rb,
activerecord/lib/active_record/encryption/context.rb,
activerecord/lib/active_record/encryption/contexts.rb,
activerecord/lib/active_record/encryption/derived_secret_key_provider.rb,
activerecord/lib/active_record/encryption/deterministic_key_provider.rb,
activerecord/lib/active_record/encryption/encryptable_record.rb,
activerecord/lib/active_record/encryption/encrypted_attribute_type.rb,
activerecord/lib/active_record/encryption/encrypted_fixtures.rb,
activerecord/lib/active_record/encryption/encrypting_only_encryptor.rb,
activerecord/lib/active_record/encryption/encryptor.rb,
activerecord/lib/active_record/encryption/envelope_encryption_key_provider.rb,
activerecord/lib/active_record/encryption/errors.rb,
activerecord/lib/active_record/encryption/extended_deterministic_queries.rb,
activerecord/lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb,
activerecord/lib/active_record/encryption/key.rb,
activerecord/lib/active_record/encryption/key_generator.rb,
activerecord/lib/active_record/encryption/key_provider.rb,
activerecord/lib/active_record/encryption/message.rb,
activerecord/lib/active_record/encryption/message_pack_message_serializer.rb,
activerecord/lib/active_record/encryption/message_serializer.rb,
activerecord/lib/active_record/encryption/null_encryptor.rb,
activerecord/lib/active_record/encryption/properties.rb,
activerecord/lib/active_record/encryption/read_only_null_encryptor.rb,
activerecord/lib/active_record/encryption/scheme.rb,
activerecord/lib/active_record/encryption/cipher/aes256_gcm.rb,
activerecord/lib/active_record/fixture_set/file.rb,
activerecord/lib/active_record/fixture_set/model_metadata.rb,
activerecord/lib/active_record/fixture_set/table_row.rb,
activerecord/lib/active_record/fixture_set/table_rows.rb,
activerecord/lib/active_record/locking/optimistic.rb,
activerecord/lib/active_record/locking/pessimistic.rb,
activerecord/lib/active_record/middleware/database_selector.rb,
activerecord/lib/active_record/middleware/shard_selector.rb,
activerecord/lib/active_record/middleware/database_selector/resolver.rb,
activerecord/lib/active_record/middleware/database_selector/resolver/session.rb,
activerecord/lib/active_record/migration/command_recorder.rb,
activerecord/lib/active_record/migration/compatibility.rb,
activerecord/lib/active_record/migration/default_schema_versions_formatter.rb,
activerecord/lib/active_record/migration/default_strategy.rb,
activerecord/lib/active_record/migration/execution_strategy.rb,
activerecord/lib/active_record/migration/join_table.rb,
activerecord/lib/active_record/migration/pending_migration_connection.rb,
activerecord/lib/active_record/railties/controller_runtime.rb,
activerecord/lib/active_record/railties/job_runtime.rb,
activerecord/lib/active_record/relation/batches.rb,
activerecord/lib/active_record/relation/calculations.rb,
activerecord/lib/active_record/relation/delegation.rb,
activerecord/lib/active_record/relation/finder_methods.rb,
activerecord/lib/active_record/relation/from_clause.rb,
activerecord/lib/active_record/relation/merger.rb,
activerecord/lib/active_record/relation/predicate_builder.rb,
activerecord/lib/active_record/relation/query_attribute.rb,
activerecord/lib/active_record/relation/query_methods.rb,
activerecord/lib/active_record/relation/spawn_methods.rb,
activerecord/lib/active_record/relation/where_clause.rb,
activerecord/lib/active_record/relation/batches/batch_enumerator.rb,
activerecord/lib/active_record/relation/predicate_builder/array_handler.rb,
activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb,
activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb,
activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb,
activerecord/lib/active_record/relation/predicate_builder/range_handler.rb,
activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb,
activerecord/lib/active_record/scoping/default.rb,
activerecord/lib/active_record/scoping/named.rb,
activerecord/lib/active_record/tasks/database_tasks.rb,
activerecord/lib/active_record/tasks/mysql_database_tasks.rb,
activerecord/lib/active_record/tasks/postgresql_database_tasks.rb,
activerecord/lib/active_record/tasks/sqlite_database_tasks.rb,
activerecord/lib/active_record/testing/query_assertions.rb,
activerecord/lib/active_record/type/adapter_specific_registry.rb,
activerecord/lib/active_record/type/date.rb,
activerecord/lib/active_record/type/date_time.rb,
activerecord/lib/active_record/type/decimal_without_scale.rb,
activerecord/lib/active_record/type/hash_lookup_type_map.rb,
activerecord/lib/active_record/type/json.rb,
activerecord/lib/active_record/type/serialized.rb,
activerecord/lib/active_record/type/text.rb,
activerecord/lib/active_record/type/time.rb,
activerecord/lib/active_record/type/type_map.rb,
activerecord/lib/active_record/type/unsigned_integer.rb,
activerecord/lib/active_record/type/internal/timezone.rb,
activerecord/lib/active_record/type_caster/connection.rb,
activerecord/lib/active_record/type_caster/map.rb,
activerecord/lib/active_record/validations/absence.rb,
activerecord/lib/active_record/validations/associated.rb,
activerecord/lib/active_record/validations/length.rb,
activerecord/lib/active_record/validations/numericality.rb,
activerecord/lib/active_record/validations/presence.rb,
activerecord/lib/active_record/validations/uniqueness.rb,
activerecord/lib/rails/generators/active_record.rb,
activerecord/lib/rails/generators/active_record/migration.rb,
activerecord/lib/rails/generators/active_record/application_record/application_record_generator.rb,
activerecord/lib/rails/generators/active_record/migration/migration_generator.rb,
activerecord/lib/rails/generators/active_record/model/model_generator.rb,
activerecord/lib/rails/generators/active_record/multi_db/multi_db_generator.rb

Overview

Validation error class to wrap association records’ errors, with index_errors support.

Constant Summary

Class Attribute Summary

Class Method Summary

::ActiveSupport::Autoload - Extended

Instance Attribute Summary

Class Attribute Details

.db_warnings_action (rw)

The action to take when database query produces warning. Must be one of :ignore, :log, :raise, :report, or a custom proc. The default is :ignore.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 232

RDoc directive :singleton-method: db_warnings_action

.db_warnings_action=(action) (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 234

def self.db_warnings_action=(action)
  @db_warnings_action =
    case action
    when :ignore
      nil
    when :log
      ->(warning) do
        warning_message = "[#{warning.class}] #{warning.message}"
        warning_message += " (#{warning.code})" if warning.code
        ActiveRecord::Base.logger.warn(warning_message)
      end
    when :raise
      ->(warning) { raise warning }
    when :report
      ->(warning) { Rails.error.report(warning, handled: true) }
    when Proc
      action
    else
      raise ArgumentError, "db_warnings_action must be one of :ignore, :log, :raise, :report, or a custom proc."
    end
end

.default_timezone=(default_timezone) (writeonly)

Determines whether to use Time.utc (using :utc) or Time.local (using :local) when pulling dates and times from the database. This is set to :utc by default.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 217

def self.default_timezone=(default_timezone)
  unless %i(local utc).include?(default_timezone)
    raise ArgumentError, "default_timezone must be either :utc (default) or :local."
  end

  @default_timezone = default_timezone
end

.global_executor_concurrency (rw)

This method is for internal use only.
[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 308

def self.global_executor_concurrency # :nodoc:
  @global_executor_concurrency ||= nil
end

.global_executor_concurrency=(global_executor_concurrency) (rw)

Set the .global_executor_concurrency. This configuration value can only be used with the global thread pool async query executor.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 300

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 the executor is nil or set to `:multi_thread_pool`. For multiple thread pools, please set the concurrency in your database configuration."
  end

  @global_executor_concurrency = global_executor_concurrency
end

.marshalling_format_version (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 471

def self.marshalling_format_version
  Marshalling.format_version
end

.marshalling_format_version=(value) (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 475

def self.marshalling_format_version=(value)
  Marshalling.format_version = value
end

.permanent_connection_checkout=(value) (writeonly)

Defines whether ActiveRecord::Base.connection is allowed, deprecated, or entirely disallowed.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 316

def self.permanent_connection_checkout=(value)
  unless [true, :deprecated, :disallowed].include?(value)
    raise ArgumentError, "permanent_connection_checkout must be one of: `true`, `:deprecated` or `:disallowed`"
  end
  @permanent_connection_checkout = value
end

Class Method Details

.action_on_strict_loading_violation

Set the application to log or raise when an association violates strict loading. Defaults to :raise.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 363

RDoc directive :singleton-method: action_on_strict_loading_violation

.after_all_transactions_commit(&block)

Registers a block to be called after all the current transactions have been committed.

If there is no currently open transaction, the block is called immediately.

If there are multiple nested transactions, the block is called after the outermost one has been committed,

If any of the currently open transactions is rolled back, the block is never called.

If multiple transactions are open across multiple databases, the block will be invoked if and once all of them have been committed. But note that nesting transactions across two distinct databases is a sharding anti-pattern that comes with a world of hurts.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 535

def self.after_all_transactions_commit(&block)
  open_transactions = all_open_transactions

  if open_transactions.empty?
    yield
  elsif open_transactions.size == 1
    open_transactions.first.after_commit(&block)
  else
    count = open_transactions.size
    callback = -> do
      count -= 1
      block.call if count.zero?
    end
    open_transactions.each do |t|
      t.after_commit(&callback)
    end
    open_transactions = nil # rubocop:disable Lint/UselessAssignment avoid holding it in the closure
  end
end

.all_open_transactions

This method is for internal use only.
[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 555

def self.all_open_transactions # :nodoc:
  open_transactions = []
  Base.connection_handler.each_connection_pool do |pool|
    if active_connection = pool.active_connection
      current_transaction = active_connection.current_transaction

      if current_transaction.open? && current_transaction.joinable?
        open_transactions << current_transaction
      end
    end
  end
  open_transactions
end

.async_query_executor

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.
[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 285

RDoc directive :singleton-method: async_query_executor

.db_warnings_ignore

Specify allowlist of database warnings. Can be a string, regular expression, or an error code from the database.

ActiveRecord::Base.db_warnings_ignore = [/`SHOW WARNINGS` did not return the warnings/, "01000"]
[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 264

RDoc directive :singleton-method: db_warnings_ignore

.deprecator

This method is for internal use only.
[ GitHub ]

  
# File 'activerecord/lib/active_record/deprecator.rb', line 4

def self.deprecator # :nodoc:
  @deprecator ||= ActiveSupport::Deprecation.new
end

.disconnect_all!

Explicitly closes all database connections in all pools.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 518

def self.disconnect_all!
  ConnectionAdapters::PoolConfig.disconnect_all!
end

.dump_schema_after_migration

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.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 417

RDoc directive :singleton-method: dump_schema_after_migration

.dump_schemas

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.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 427

RDoc directive :singleton-method: dump_schemas

.eager_load!

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 507

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

.error_on_ignored_order

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.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 382

RDoc directive :singleton-method: error_on_ignored_order

.gem_version

Returns the currently loaded version of Active Record as a Gem::Version.

[ GitHub ]

  
# File 'activerecord/lib/active_record/gem_version.rb', line 5

def self.gem_version
  Gem::Version.new VERSION::STRING
end

.generate_secure_token_on

Controls when to generate a value for has_secure_token declarations. Defaults to :create.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 468

RDoc directive :singleton-method: generate_secure_token_on

.global_thread_pool_async_query_executor

This method is for internal use only.
[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 288

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

.lazily_load_schema_cache

Lazily load the schema cache. This option will load the schema cache when a connection is established rather than on boot.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 188

RDoc directive :singleton-method: lazily_load_schema_cache

.migration_strategy

Specify strategy to use for executing migrations.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 402

RDoc directive :singleton-method: migration_strategy

.protocol_adapters

Provides a mapping between database protocols/DBMSs and the underlying database adapter to be used. This is used only by the DATABASE_URL environment variable.

Example

DATABASE_URL="mysql://myuser:mypass@localhost/somedatabase"

The above URL specifies that MySQL is the desired protocol/DBMS, and the application configuration can then decide which adapter to use. For this example the default mapping is from mysql to mysql2, but :trilogy is also supported.

ActiveRecord.protocol_adapters.mysql = "mysql2"

The protocols names are arbitrary, and external database adapters can be registered and set here.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 498

RDoc directive :singleton-method: protocol_adapters

.queues

Specifies the names of the queues used by background jobs.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 338

RDoc directive :singleton-method: queues

.raise_int_wider_than_64bit

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

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 454

RDoc directive :singleton-method: raise_int_wider_than_64bit

.schema_cache_ignored_table?(table_name) ⇒ Boolean

Checks to see if the table_name is ignored by checking against the .schema_cache_ignored_tables option.

ActiveRecord.schema_cache_ignored_table?(:developers)
[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 204

def self.schema_cache_ignored_table?(table_name)
  ActiveRecord.schema_cache_ignored_tables.any? do |ignored|
    ignored === table_name
  end
end

.schema_cache_ignored_tables

A list of tables or regex’s to match tables to ignore when dumping the schema cache. For example if this is set to [/^_/] the schema cache will not dump tables named with an underscore.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 196

RDoc directive :singleton-method: schema_cache_ignored_tables

.schema_format

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.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 374

RDoc directive :singleton-method: schema_format

.schema_versions_formatter

Specify the formatter used by schema dumper to format versions information.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 408

RDoc directive :singleton-method: schema_versions_formatter

.timestamped_migrations

Specify whether or not to use timestamps for migration versions

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 388

RDoc directive :singleton-method: timestamped_migrations

.use_yaml_unsafe_load

Application configurable boolean that instructs the YAML Coder to use an unsafe load if set to true.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 446

RDoc directive :singleton-method: use_yaml_unsafe_load

.validate_migration_timestamps

Specify whether or not to validate migration timestamps. When set, an error will be raised if a timestamp is more than a day ahead of the timestamp associated with the current time. .timestamped_migrations must be set to true.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 396

RDoc directive :singleton-method: validate_migration_timestamps

.verbose_query_logs

Specifies if the methods calling database queries should be logged below their relevant queries. Defaults to false.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 331

RDoc directive :singleton-method: verbose_query_logs

.verify_foreign_keys_for_fixtures

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.

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 436

RDoc directive :singleton-method: verify_foreign_keys_for_fixtures

.version

Returns the currently loaded version of Active Record as a Gem::Version.

[ GitHub ]

  
# File 'activerecord/lib/active_record/version.rb', line 7

def self.version
  gem_version
end

.yaml_column_permitted_classes

Application configurable array that provides additional permitted classes to Psych safe_load in the YAML Coder

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 461

RDoc directive :singleton-method: yaml_column_permitted_classes

Instance Attribute Details

#action_on_strict_loading_violation (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 363

singleton_class.attr_accessor :action_on_strict_loading_violation

#application_record_class (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 356

singleton_class.attr_accessor :application_record_class

#async_query_executor (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 285

singleton_class.attr_accessor :async_query_executor

#before_committed_on_all_records (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 350

singleton_class.attr_accessor :before_committed_on_all_records

#belongs_to_required_validates_foreign_key (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 347

singleton_class.attr_accessor :belongs_to_required_validates_foreign_key

#database_cli (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 210

singleton_class.attr_accessor :database_cli

#db_warnings_action (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 232

singleton_class.attr_reader :db_warnings_action

#db_warnings_ignore (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 264

singleton_class.attr_accessor :db_warnings_ignore

#default_timezone (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 213

singleton_class.attr_reader :default_timezone

#disable_prepared_statements (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 181

singleton_class.attr_accessor :disable_prepared_statements

#dump_schema_after_migration (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 417

singleton_class.attr_accessor :dump_schema_after_migration

#dump_schemas (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 427

singleton_class.attr_accessor :dump_schemas

#error_on_ignored_order (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 382

singleton_class.attr_accessor :error_on_ignored_order

#generate_secure_token_on (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 468

singleton_class.attr_accessor :generate_secure_token_on

#index_nested_attribute_errors (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 323

singleton_class.attr_accessor :index_nested_attribute_errors

#lazily_load_schema_cache (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 188

singleton_class.attr_accessor :lazily_load_schema_cache

#maintain_test_schema (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 341

singleton_class.attr_accessor :maintain_test_schema

#migration_strategy (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 402

singleton_class.attr_accessor :migration_strategy

#permanent_connection_checkout (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 313

singleton_class.attr_reader :permanent_connection_checkout

#protocol_adapters (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 498

singleton_class.attr_accessor :protocol_adapters

#query_transformers (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 439

singleton_class.attr_accessor :query_transformers

#queues (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 338

singleton_class.attr_accessor :queues

#raise_int_wider_than_64bit (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 454

singleton_class.attr_accessor :raise_int_wider_than_64bit

#raise_on_assign_to_attr_readonly (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 344

singleton_class.attr_accessor :raise_on_assign_to_attr_readonly

#reading_role (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 270

singleton_class.attr_accessor :reading_role

#run_after_transaction_callbacks_in_order_defined (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 353

singleton_class.attr_accessor :run_after_transaction_callbacks_in_order_defined

#schema_cache_ignored_tables (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 196

singleton_class.attr_accessor :schema_cache_ignored_tables

#schema_format (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 374

singleton_class.attr_accessor :schema_format

#schema_versions_formatter (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 408

singleton_class.attr_accessor :schema_versions_formatter

#timestamped_migrations (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 388

singleton_class.attr_accessor :timestamped_migrations

#use_yaml_unsafe_load (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 446

singleton_class.attr_accessor :use_yaml_unsafe_load

#validate_migration_timestamps (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 396

singleton_class.attr_accessor :validate_migration_timestamps

#verbose_query_logs (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 331

singleton_class.attr_accessor :verbose_query_logs

#verify_foreign_keys_for_fixtures (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 436

singleton_class.attr_accessor :verify_foreign_keys_for_fixtures

#writing_role (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 267

singleton_class.attr_accessor :writing_role

#yaml_column_permitted_classes (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record.rb', line 461

singleton_class.attr_accessor :yaml_column_permitted_classes