mirror of https://github.com/rails/rails
[Active Record] require => require_relative
This commit is contained in:
parent
ee5cfc01a5
commit
9d4f79d3d3
|
@ -26,8 +26,8 @@ require "active_support/rails"
|
|||
require "active_model"
|
||||
require "arel"
|
||||
|
||||
require "active_record/version"
|
||||
require "active_record/attribute_set"
|
||||
require_relative "active_record/version"
|
||||
require_relative "active_record/attribute_set"
|
||||
|
||||
module ActiveRecord
|
||||
extend ActiveSupport::Autoload
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "active_support/core_ext/enumerable"
|
||||
require "active_support/core_ext/string/conversions"
|
||||
require "active_support/core_ext/module/remove_method"
|
||||
require "active_record/errors"
|
||||
require_relative "errors"
|
||||
|
||||
module ActiveRecord
|
||||
class AssociationNotFoundError < ConfigurationError #:nodoc:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/associations"
|
||||
require_relative "../../associations"
|
||||
|
||||
module ActiveRecord::Associations::Builder # :nodoc:
|
||||
class CollectionAssociation < Association #:nodoc:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/associations/join_dependency/join_part"
|
||||
require_relative "join_part"
|
||||
|
||||
module ActiveRecord
|
||||
module Associations
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/associations/join_dependency/join_part"
|
||||
require_relative "join_part"
|
||||
|
||||
module ActiveRecord
|
||||
module Associations
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/attribute"
|
||||
require_relative "../attribute"
|
||||
|
||||
module ActiveRecord
|
||||
class Attribute # :nodoc:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
require "active_support/core_ext/module/attribute_accessors"
|
||||
require "active_record/attribute_mutation_tracker"
|
||||
require_relative "../attribute_mutation_tracker"
|
||||
|
||||
module ActiveRecord
|
||||
module AttributeMethods
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "active_record/attribute_set/builder"
|
||||
require "active_record/attribute_set/yaml_encoder"
|
||||
require_relative "attribute_set/builder"
|
||||
require_relative "attribute_set/yaml_encoder"
|
||||
|
||||
module ActiveRecord
|
||||
class AttributeSet # :nodoc:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/attribute"
|
||||
require_relative "../attribute"
|
||||
|
||||
module ActiveRecord
|
||||
class AttributeSet # :nodoc:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/attribute/user_provided_default"
|
||||
require_relative "attribute/user_provided_default"
|
||||
|
||||
module ActiveRecord
|
||||
# See ActiveRecord::Attributes::ClassMethods for documentation
|
||||
|
|
|
@ -13,14 +13,14 @@ require "active_support/core_ext/kernel/singleton_class"
|
|||
require "active_support/core_ext/module/introspection"
|
||||
require "active_support/core_ext/object/duplicable"
|
||||
require "active_support/core_ext/class/subclasses"
|
||||
require "active_record/attribute_decorators"
|
||||
require "active_record/define_callbacks"
|
||||
require "active_record/errors"
|
||||
require "active_record/log_subscriber"
|
||||
require "active_record/explain_subscriber"
|
||||
require "active_record/relation/delegation"
|
||||
require "active_record/attributes"
|
||||
require "active_record/type_caster"
|
||||
require_relative "attribute_decorators"
|
||||
require_relative "define_callbacks"
|
||||
require_relative "errors"
|
||||
require_relative "log_subscriber"
|
||||
require_relative "explain_subscriber"
|
||||
require_relative "relation/delegation"
|
||||
require_relative "attributes"
|
||||
require_relative "type_caster"
|
||||
|
||||
module ActiveRecord #:nodoc:
|
||||
# = Active Record
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/migration/join_table"
|
||||
require_relative "../../migration/join_table"
|
||||
require "active_support/core_ext/string/access"
|
||||
require "digest"
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require "active_record/type"
|
||||
require "active_record/connection_adapters/determine_if_preparable_visitor"
|
||||
require "active_record/connection_adapters/schema_cache"
|
||||
require "active_record/connection_adapters/sql_type_metadata"
|
||||
require "active_record/connection_adapters/abstract/schema_dumper"
|
||||
require "active_record/connection_adapters/abstract/schema_creation"
|
||||
require_relative "../type"
|
||||
require_relative "determine_if_preparable_visitor"
|
||||
require_relative "schema_cache"
|
||||
require_relative "sql_type_metadata"
|
||||
require_relative "abstract/schema_dumper"
|
||||
require_relative "abstract/schema_creation"
|
||||
require "arel/collectors/bind"
|
||||
require "arel/collectors/sql_string"
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require "active_record/connection_adapters/abstract_adapter"
|
||||
require "active_record/connection_adapters/statement_pool"
|
||||
require "active_record/connection_adapters/mysql/column"
|
||||
require "active_record/connection_adapters/mysql/explain_pretty_printer"
|
||||
require "active_record/connection_adapters/mysql/quoting"
|
||||
require "active_record/connection_adapters/mysql/schema_creation"
|
||||
require "active_record/connection_adapters/mysql/schema_definitions"
|
||||
require "active_record/connection_adapters/mysql/schema_dumper"
|
||||
require "active_record/connection_adapters/mysql/schema_statements"
|
||||
require "active_record/connection_adapters/mysql/type_metadata"
|
||||
require_relative "abstract_adapter"
|
||||
require_relative "statement_pool"
|
||||
require_relative "mysql/column"
|
||||
require_relative "mysql/explain_pretty_printer"
|
||||
require_relative "mysql/quoting"
|
||||
require_relative "mysql/schema_creation"
|
||||
require_relative "mysql/schema_definitions"
|
||||
require_relative "mysql/schema_dumper"
|
||||
require_relative "mysql/schema_statements"
|
||||
require_relative "mysql/type_metadata"
|
||||
|
||||
require "active_support/core_ext/string/strip"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "active_record/connection_adapters/abstract_mysql_adapter"
|
||||
require "active_record/connection_adapters/mysql/database_statements"
|
||||
require_relative "abstract_mysql_adapter"
|
||||
require_relative "mysql/database_statements"
|
||||
|
||||
gem "mysql2", ">= 0.3.18", "< 0.5"
|
||||
require "mysql2"
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
require "active_record/connection_adapters/postgresql/oid/array"
|
||||
require "active_record/connection_adapters/postgresql/oid/bit"
|
||||
require "active_record/connection_adapters/postgresql/oid/bit_varying"
|
||||
require "active_record/connection_adapters/postgresql/oid/bytea"
|
||||
require "active_record/connection_adapters/postgresql/oid/cidr"
|
||||
require "active_record/connection_adapters/postgresql/oid/date_time"
|
||||
require "active_record/connection_adapters/postgresql/oid/decimal"
|
||||
require "active_record/connection_adapters/postgresql/oid/enum"
|
||||
require "active_record/connection_adapters/postgresql/oid/hstore"
|
||||
require "active_record/connection_adapters/postgresql/oid/inet"
|
||||
require "active_record/connection_adapters/postgresql/oid/json"
|
||||
require "active_record/connection_adapters/postgresql/oid/jsonb"
|
||||
require "active_record/connection_adapters/postgresql/oid/money"
|
||||
require "active_record/connection_adapters/postgresql/oid/oid"
|
||||
require "active_record/connection_adapters/postgresql/oid/point"
|
||||
require "active_record/connection_adapters/postgresql/oid/legacy_point"
|
||||
require "active_record/connection_adapters/postgresql/oid/range"
|
||||
require "active_record/connection_adapters/postgresql/oid/specialized_string"
|
||||
require "active_record/connection_adapters/postgresql/oid/uuid"
|
||||
require "active_record/connection_adapters/postgresql/oid/vector"
|
||||
require "active_record/connection_adapters/postgresql/oid/xml"
|
||||
require_relative "oid/array"
|
||||
require_relative "oid/bit"
|
||||
require_relative "oid/bit_varying"
|
||||
require_relative "oid/bytea"
|
||||
require_relative "oid/cidr"
|
||||
require_relative "oid/date_time"
|
||||
require_relative "oid/decimal"
|
||||
require_relative "oid/enum"
|
||||
require_relative "oid/hstore"
|
||||
require_relative "oid/inet"
|
||||
require_relative "oid/json"
|
||||
require_relative "oid/jsonb"
|
||||
require_relative "oid/money"
|
||||
require_relative "oid/oid"
|
||||
require_relative "oid/point"
|
||||
require_relative "oid/legacy_point"
|
||||
require_relative "oid/range"
|
||||
require_relative "oid/specialized_string"
|
||||
require_relative "oid/uuid"
|
||||
require_relative "oid/vector"
|
||||
require_relative "oid/xml"
|
||||
|
||||
require "active_record/connection_adapters/postgresql/oid/type_map_initializer"
|
||||
require_relative "oid/type_map_initializer"
|
||||
|
||||
module ActiveRecord
|
||||
module ConnectionAdapters
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
gem "pg", "~> 0.18"
|
||||
require "pg"
|
||||
|
||||
require "active_record/connection_adapters/abstract_adapter"
|
||||
require "active_record/connection_adapters/statement_pool"
|
||||
require "active_record/connection_adapters/postgresql/column"
|
||||
require "active_record/connection_adapters/postgresql/database_statements"
|
||||
require "active_record/connection_adapters/postgresql/explain_pretty_printer"
|
||||
require "active_record/connection_adapters/postgresql/oid"
|
||||
require "active_record/connection_adapters/postgresql/quoting"
|
||||
require "active_record/connection_adapters/postgresql/referential_integrity"
|
||||
require "active_record/connection_adapters/postgresql/schema_creation"
|
||||
require "active_record/connection_adapters/postgresql/schema_definitions"
|
||||
require "active_record/connection_adapters/postgresql/schema_dumper"
|
||||
require "active_record/connection_adapters/postgresql/schema_statements"
|
||||
require "active_record/connection_adapters/postgresql/type_metadata"
|
||||
require "active_record/connection_adapters/postgresql/utils"
|
||||
require_relative "abstract_adapter"
|
||||
require_relative "statement_pool"
|
||||
require_relative "postgresql/column"
|
||||
require_relative "postgresql/database_statements"
|
||||
require_relative "postgresql/explain_pretty_printer"
|
||||
require_relative "postgresql/oid"
|
||||
require_relative "postgresql/quoting"
|
||||
require_relative "postgresql/referential_integrity"
|
||||
require_relative "postgresql/schema_creation"
|
||||
require_relative "postgresql/schema_definitions"
|
||||
require_relative "postgresql/schema_dumper"
|
||||
require_relative "postgresql/schema_statements"
|
||||
require_relative "postgresql/type_metadata"
|
||||
require_relative "postgresql/utils"
|
||||
|
||||
module ActiveRecord
|
||||
module ConnectionHandling # :nodoc:
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
require "active_record/connection_adapters/abstract_adapter"
|
||||
require "active_record/connection_adapters/statement_pool"
|
||||
require "active_record/connection_adapters/sqlite3/explain_pretty_printer"
|
||||
require "active_record/connection_adapters/sqlite3/quoting"
|
||||
require "active_record/connection_adapters/sqlite3/schema_creation"
|
||||
require "active_record/connection_adapters/sqlite3/schema_definitions"
|
||||
require "active_record/connection_adapters/sqlite3/schema_dumper"
|
||||
require "active_record/connection_adapters/sqlite3/schema_statements"
|
||||
require_relative "abstract_adapter"
|
||||
require_relative "statement_pool"
|
||||
require_relative "sqlite3/explain_pretty_printer"
|
||||
require_relative "sqlite3/quoting"
|
||||
require_relative "sqlite3/schema_creation"
|
||||
require_relative "sqlite3/schema_definitions"
|
||||
require_relative "sqlite3/schema_dumper"
|
||||
require_relative "sqlite3/schema_statements"
|
||||
|
||||
gem "sqlite3", "~> 1.3.6"
|
||||
require "sqlite3"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/explain_registry"
|
||||
require_relative "explain_registry"
|
||||
|
||||
module ActiveRecord
|
||||
module Explain
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "active_support/notifications"
|
||||
require "active_record/explain_registry"
|
||||
require_relative "explain_registry"
|
||||
|
||||
module ActiveRecord
|
||||
class ExplainSubscriber # :nodoc:
|
||||
|
|
|
@ -4,8 +4,8 @@ require "zlib"
|
|||
require "set"
|
||||
require "active_support/dependencies"
|
||||
require "active_support/core_ext/digest/uuid"
|
||||
require "active_record/fixture_set/file"
|
||||
require "active_record/errors"
|
||||
require_relative "fixture_set/file"
|
||||
require_relative "errors"
|
||||
|
||||
module ActiveRecord
|
||||
class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "active_record/scoping/default"
|
||||
require "active_record/scoping/named"
|
||||
require_relative "scoping/default"
|
||||
require_relative "scoping/named"
|
||||
|
||||
module ActiveRecord
|
||||
# This class is used to create a table that keeps track of values and keys such
|
||||
|
|
|
@ -48,8 +48,8 @@ module ActiveRecord
|
|||
# to avoid cross references when loading a constant for the
|
||||
# first time. Also, make it output to STDERR.
|
||||
console do |app|
|
||||
require "active_record/railties/console_sandbox" if app.sandbox?
|
||||
require "active_record/base"
|
||||
require_relative "railties/console_sandbox" if app.sandbox?
|
||||
require_relative "base"
|
||||
unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT)
|
||||
console = ActiveSupport::Logger.new(STDERR)
|
||||
Rails.logger.extend ActiveSupport::Logger.broadcast console
|
||||
|
@ -57,7 +57,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
runner do
|
||||
require "active_record/base"
|
||||
require_relative "base"
|
||||
end
|
||||
|
||||
initializer "active_record.initialize_timezone" do
|
||||
|
@ -101,7 +101,7 @@ module ActiveRecord
|
|||
initializer "active_record.warn_on_records_fetched_greater_than" do
|
||||
if config.active_record.warn_on_records_fetched_greater_than
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
require "active_record/relation/record_fetch_warning"
|
||||
require_relative "relation/record_fetch_warning"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -139,7 +139,7 @@ end_warning
|
|||
|
||||
# Expose database runtime to controller for logging.
|
||||
initializer "active_record.log_runtime" do
|
||||
require "active_record/railties/controller_runtime"
|
||||
require_relative "railties/controller_runtime"
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
include ActiveRecord::Railties::ControllerRuntime
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "active_support/core_ext/module/attr_internal"
|
||||
require "active_record/log_subscriber"
|
||||
require_relative "../log_subscriber"
|
||||
|
||||
module ActiveRecord
|
||||
module Railties # :nodoc:
|
||||
|
|
|
@ -187,7 +187,7 @@ db_namespace = namespace :db do
|
|||
namespace :fixtures do
|
||||
desc "Loads fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
|
||||
task load: [:environment, :load_config] do
|
||||
require "active_record/fixtures"
|
||||
require_relative "../fixtures"
|
||||
|
||||
base_dir = ActiveRecord::Tasks::DatabaseTasks.fixtures_path
|
||||
|
||||
|
@ -209,7 +209,7 @@ db_namespace = namespace :db do
|
|||
|
||||
# desc "Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
|
||||
task identify: [:environment, :load_config] do
|
||||
require "active_record/fixtures"
|
||||
require_relative "../fixtures"
|
||||
|
||||
label, id = ENV["LABEL"], ENV["ID"]
|
||||
raise "LABEL or ID required" if label.blank? && id.blank?
|
||||
|
@ -235,7 +235,7 @@ db_namespace = namespace :db do
|
|||
namespace :schema do
|
||||
desc "Creates a db/schema.rb file that is portable against any DB supported by Active Record"
|
||||
task dump: [:environment, :load_config] do
|
||||
require "active_record/schema_dumper"
|
||||
require_relative "../schema_dumper"
|
||||
filename = ENV["SCHEMA"] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "schema.rb")
|
||||
File.open(filename, "w:utf-8") do |file|
|
||||
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/relation/batches/batch_enumerator"
|
||||
require_relative "batches/batch_enumerator"
|
||||
|
||||
module ActiveRecord
|
||||
module Batches
|
||||
|
|
|
@ -175,11 +175,11 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
|
||||
require "active_record/relation/predicate_builder/array_handler"
|
||||
require "active_record/relation/predicate_builder/base_handler"
|
||||
require "active_record/relation/predicate_builder/basic_object_handler"
|
||||
require "active_record/relation/predicate_builder/range_handler"
|
||||
require "active_record/relation/predicate_builder/relation_handler"
|
||||
require_relative "predicate_builder/array_handler"
|
||||
require_relative "predicate_builder/base_handler"
|
||||
require_relative "predicate_builder/basic_object_handler"
|
||||
require_relative "predicate_builder/range_handler"
|
||||
require_relative "predicate_builder/relation_handler"
|
||||
|
||||
require "active_record/relation/predicate_builder/association_query_value"
|
||||
require "active_record/relation/predicate_builder/polymorphic_array_value"
|
||||
require_relative "predicate_builder/association_query_value"
|
||||
require_relative "predicate_builder/polymorphic_array_value"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "active_record/attribute"
|
||||
require_relative "../attribute"
|
||||
|
||||
module ActiveRecord
|
||||
class Relation
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "active_record/relation/from_clause"
|
||||
require "active_record/relation/query_attribute"
|
||||
require "active_record/relation/where_clause"
|
||||
require "active_record/relation/where_clause_factory"
|
||||
require_relative "from_clause"
|
||||
require_relative "query_attribute"
|
||||
require_relative "where_clause"
|
||||
require_relative "where_clause_factory"
|
||||
require "active_model/forbidden_attributes_protection"
|
||||
|
||||
module ActiveRecord
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "active_support/core_ext/hash/except"
|
||||
require "active_support/core_ext/hash/slice"
|
||||
require "active_record/relation/merger"
|
||||
require_relative "merger"
|
||||
|
||||
module ActiveRecord
|
||||
module SpawnMethods
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "active_record/scoping/default"
|
||||
require "active_record/scoping/named"
|
||||
require_relative "scoping/default"
|
||||
require_relative "scoping/named"
|
||||
|
||||
module ActiveRecord
|
||||
# This class is used to create a table that keeps track of which migrations
|
||||
|
|
|
@ -99,7 +99,7 @@ module ActiveRecord
|
|||
|
||||
def error_class
|
||||
if configuration["adapter"].include?("jdbc")
|
||||
require "active_record/railties/jdbcmysql_error"
|
||||
require_relative "../railties/jdbcmysql_error"
|
||||
ArJdbcMySQL::Error
|
||||
elsif defined?(Mysql2)
|
||||
Mysql2::Error
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
require "active_model/type"
|
||||
|
||||
require "active_record/type/internal/timezone"
|
||||
require_relative "type/internal/timezone"
|
||||
|
||||
require "active_record/type/date"
|
||||
require "active_record/type/date_time"
|
||||
require "active_record/type/decimal_without_scale"
|
||||
require "active_record/type/json"
|
||||
require "active_record/type/time"
|
||||
require "active_record/type/text"
|
||||
require "active_record/type/unsigned_integer"
|
||||
require_relative "type/date"
|
||||
require_relative "type/date_time"
|
||||
require_relative "type/decimal_without_scale"
|
||||
require_relative "type/json"
|
||||
require_relative "type/time"
|
||||
require_relative "type/text"
|
||||
require_relative "type/unsigned_integer"
|
||||
|
||||
require "active_record/type/serialized"
|
||||
require "active_record/type/adapter_specific_registry"
|
||||
require_relative "type/serialized"
|
||||
require_relative "type/adapter_specific_registry"
|
||||
|
||||
require "active_record/type/type_map"
|
||||
require "active_record/type/hash_lookup_type_map"
|
||||
require_relative "type/type_map"
|
||||
require_relative "type/hash_lookup_type_map"
|
||||
|
||||
module ActiveRecord
|
||||
module Type
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "active_record/type_caster/map"
|
||||
require "active_record/type_caster/connection"
|
||||
require_relative "type_caster/map"
|
||||
require_relative "type_caster/connection"
|
||||
|
||||
module ActiveRecord
|
||||
module TypeCaster # :nodoc:
|
||||
|
|
|
@ -84,8 +84,8 @@ module ActiveRecord
|
|||
end
|
||||
end
|
||||
|
||||
require "active_record/validations/associated"
|
||||
require "active_record/validations/uniqueness"
|
||||
require "active_record/validations/presence"
|
||||
require "active_record/validations/absence"
|
||||
require "active_record/validations/length"
|
||||
require_relative "validations/associated"
|
||||
require_relative "validations/uniqueness"
|
||||
require_relative "validations/presence"
|
||||
require_relative "validations/absence"
|
||||
require_relative "validations/length"
|
||||
|
|
Loading…
Reference in New Issue