1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[Active Record] require => require_relative

This basically reverts 9d4f79d3d3
This commit is contained in:
Akira Matsuda 2017-10-21 22:17:03 +09:00
parent 8c2ba84d63
commit d5ea33b9a0
35 changed files with 133 additions and 133 deletions

View file

@ -28,8 +28,8 @@ require "active_support/rails"
require "active_model" require "active_model"
require "arel" require "arel"
require_relative "active_record/version" require "active_record/version"
require_relative "active_record/attribute_set" require "active_record/attribute_set"
module ActiveRecord module ActiveRecord
extend ActiveSupport::Autoload extend ActiveSupport::Autoload

View file

@ -3,7 +3,7 @@
require "active_support/core_ext/enumerable" require "active_support/core_ext/enumerable"
require "active_support/core_ext/string/conversions" require "active_support/core_ext/string/conversions"
require "active_support/core_ext/module/remove_method" require "active_support/core_ext/module/remove_method"
require_relative "errors" require "active_record/errors"
module ActiveRecord module ActiveRecord
class AssociationNotFoundError < ConfigurationError #:nodoc: class AssociationNotFoundError < ConfigurationError #:nodoc:

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../../associations" require "active_record/associations"
module ActiveRecord::Associations::Builder # :nodoc: module ActiveRecord::Associations::Builder # :nodoc:
class CollectionAssociation < Association #:nodoc: class CollectionAssociation < Association #:nodoc:

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "join_part" require "active_record/associations/join_dependency/join_part"
module ActiveRecord module ActiveRecord
module Associations module Associations

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "join_part" require "active_record/associations/join_dependency/join_part"
module ActiveRecord module ActiveRecord
module Associations module Associations

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../attribute" require "active_record/attribute"
module ActiveRecord module ActiveRecord
class Attribute # :nodoc: class Attribute # :nodoc:

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "active_support/core_ext/module/attribute_accessors" require "active_support/core_ext/module/attribute_accessors"
require_relative "../attribute_mutation_tracker" require "active_record/attribute_mutation_tracker"
module ActiveRecord module ActiveRecord
module AttributeMethods module AttributeMethods

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "attribute_set/builder" require "active_record/attribute_set/builder"
require_relative "attribute_set/yaml_encoder" require "active_record/attribute_set/yaml_encoder"
module ActiveRecord module ActiveRecord
class AttributeSet # :nodoc: class AttributeSet # :nodoc:

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../attribute" require "active_record/attribute"
module ActiveRecord module ActiveRecord
class AttributeSet # :nodoc: class AttributeSet # :nodoc:

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "attribute/user_provided_default" require "active_record/attribute/user_provided_default"
module ActiveRecord module ActiveRecord
# See ActiveRecord::Attributes::ClassMethods for documentation # See ActiveRecord::Attributes::ClassMethods for documentation

View file

@ -15,14 +15,14 @@ require "active_support/core_ext/kernel/singleton_class"
require "active_support/core_ext/module/introspection" require "active_support/core_ext/module/introspection"
require "active_support/core_ext/object/duplicable" require "active_support/core_ext/object/duplicable"
require "active_support/core_ext/class/subclasses" require "active_support/core_ext/class/subclasses"
require_relative "attribute_decorators" require "active_record/attribute_decorators"
require_relative "define_callbacks" require "active_record/define_callbacks"
require_relative "errors" require "active_record/errors"
require_relative "log_subscriber" require "active_record/log_subscriber"
require_relative "explain_subscriber" require "active_record/explain_subscriber"
require_relative "relation/delegation" require "active_record/relation/delegation"
require_relative "attributes" require "active_record/attributes"
require_relative "type_caster" require "active_record/type_caster"
module ActiveRecord #:nodoc: module ActiveRecord #:nodoc:
# = Active Record # = Active Record

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../../migration/join_table" require "active_record/migration/join_table"
require "active_support/core_ext/string/access" require "active_support/core_ext/string/access"
require "digest/sha2" require "digest/sha2"

View file

@ -1,11 +1,11 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../type" require "active_record/type"
require_relative "determine_if_preparable_visitor" require "active_record/connection_adapters/determine_if_preparable_visitor"
require_relative "schema_cache" require "active_record/connection_adapters/schema_cache"
require_relative "sql_type_metadata" require "active_record/connection_adapters/sql_type_metadata"
require_relative "abstract/schema_dumper" require "active_record/connection_adapters/abstract/schema_dumper"
require_relative "abstract/schema_creation" require "active_record/connection_adapters/abstract/schema_creation"
require "arel/collectors/bind" require "arel/collectors/bind"
require "arel/collectors/composite" require "arel/collectors/composite"
require "arel/collectors/sql_string" require "arel/collectors/sql_string"

View file

@ -1,15 +1,15 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "abstract_adapter" require "active_record/connection_adapters/abstract_adapter"
require_relative "statement_pool" require "active_record/connection_adapters/statement_pool"
require_relative "mysql/column" require "active_record/connection_adapters/mysql/column"
require_relative "mysql/explain_pretty_printer" require "active_record/connection_adapters/mysql/explain_pretty_printer"
require_relative "mysql/quoting" require "active_record/connection_adapters/mysql/quoting"
require_relative "mysql/schema_creation" require "active_record/connection_adapters/mysql/schema_creation"
require_relative "mysql/schema_definitions" require "active_record/connection_adapters/mysql/schema_definitions"
require_relative "mysql/schema_dumper" require "active_record/connection_adapters/mysql/schema_dumper"
require_relative "mysql/schema_statements" require "active_record/connection_adapters/mysql/schema_statements"
require_relative "mysql/type_metadata" require "active_record/connection_adapters/mysql/type_metadata"
require "active_support/core_ext/string/strip" require "active_support/core_ext/string/strip"

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "abstract_mysql_adapter" require "active_record/connection_adapters/abstract_mysql_adapter"
require_relative "mysql/database_statements" require "active_record/connection_adapters/mysql/database_statements"
gem "mysql2", ">= 0.3.18", "< 0.5" gem "mysql2", ">= 0.3.18", "< 0.5"
require "mysql2" require "mysql2"

View file

@ -1,27 +1,27 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "oid/array" require "active_record/connection_adapters/postgresql/oid/array"
require_relative "oid/bit" require "active_record/connection_adapters/postgresql/oid/bit"
require_relative "oid/bit_varying" require "active_record/connection_adapters/postgresql/oid/bit_varying"
require_relative "oid/bytea" require "active_record/connection_adapters/postgresql/oid/bytea"
require_relative "oid/cidr" require "active_record/connection_adapters/postgresql/oid/cidr"
require_relative "oid/date_time" require "active_record/connection_adapters/postgresql/oid/date_time"
require_relative "oid/decimal" require "active_record/connection_adapters/postgresql/oid/decimal"
require_relative "oid/enum" require "active_record/connection_adapters/postgresql/oid/enum"
require_relative "oid/hstore" require "active_record/connection_adapters/postgresql/oid/hstore"
require_relative "oid/inet" require "active_record/connection_adapters/postgresql/oid/inet"
require_relative "oid/jsonb" require "active_record/connection_adapters/postgresql/oid/jsonb"
require_relative "oid/money" require "active_record/connection_adapters/postgresql/oid/money"
require_relative "oid/oid" require "active_record/connection_adapters/postgresql/oid/oid"
require_relative "oid/point" require "active_record/connection_adapters/postgresql/oid/point"
require_relative "oid/legacy_point" require "active_record/connection_adapters/postgresql/oid/legacy_point"
require_relative "oid/range" require "active_record/connection_adapters/postgresql/oid/range"
require_relative "oid/specialized_string" require "active_record/connection_adapters/postgresql/oid/specialized_string"
require_relative "oid/uuid" require "active_record/connection_adapters/postgresql/oid/uuid"
require_relative "oid/vector" require "active_record/connection_adapters/postgresql/oid/vector"
require_relative "oid/xml" require "active_record/connection_adapters/postgresql/oid/xml"
require_relative "oid/type_map_initializer" require "active_record/connection_adapters/postgresql/oid/type_map_initializer"
module ActiveRecord module ActiveRecord
module ConnectionAdapters module ConnectionAdapters

View file

@ -4,20 +4,20 @@
gem "pg", "~> 0.18" gem "pg", "~> 0.18"
require "pg" require "pg"
require_relative "abstract_adapter" require "active_record/connection_adapters/abstract_adapter"
require_relative "statement_pool" require "active_record/connection_adapters/statement_pool"
require_relative "postgresql/column" require "active_record/connection_adapters/postgresql/column"
require_relative "postgresql/database_statements" require "active_record/connection_adapters/postgresql/database_statements"
require_relative "postgresql/explain_pretty_printer" require "active_record/connection_adapters/postgresql/explain_pretty_printer"
require_relative "postgresql/oid" require "active_record/connection_adapters/postgresql/oid"
require_relative "postgresql/quoting" require "active_record/connection_adapters/postgresql/quoting"
require_relative "postgresql/referential_integrity" require "active_record/connection_adapters/postgresql/referential_integrity"
require_relative "postgresql/schema_creation" require "active_record/connection_adapters/postgresql/schema_creation"
require_relative "postgresql/schema_definitions" require "active_record/connection_adapters/postgresql/schema_definitions"
require_relative "postgresql/schema_dumper" require "active_record/connection_adapters/postgresql/schema_dumper"
require_relative "postgresql/schema_statements" require "active_record/connection_adapters/postgresql/schema_statements"
require_relative "postgresql/type_metadata" require "active_record/connection_adapters/postgresql/type_metadata"
require_relative "postgresql/utils" require "active_record/connection_adapters/postgresql/utils"
module ActiveRecord module ActiveRecord
module ConnectionHandling # :nodoc: module ConnectionHandling # :nodoc:

View file

@ -1,13 +1,13 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "abstract_adapter" require "active_record/connection_adapters/abstract_adapter"
require_relative "statement_pool" require "active_record/connection_adapters/statement_pool"
require_relative "sqlite3/explain_pretty_printer" require "active_record/connection_adapters/sqlite3/explain_pretty_printer"
require_relative "sqlite3/quoting" require "active_record/connection_adapters/sqlite3/quoting"
require_relative "sqlite3/schema_creation" require "active_record/connection_adapters/sqlite3/schema_creation"
require_relative "sqlite3/schema_definitions" require "active_record/connection_adapters/sqlite3/schema_definitions"
require_relative "sqlite3/schema_dumper" require "active_record/connection_adapters/sqlite3/schema_dumper"
require_relative "sqlite3/schema_statements" require "active_record/connection_adapters/sqlite3/schema_statements"
gem "sqlite3", "~> 1.3.6" gem "sqlite3", "~> 1.3.6"
require "sqlite3" require "sqlite3"

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "explain_registry" require "active_record/explain_registry"
module ActiveRecord module ActiveRecord
module Explain module Explain

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "active_support/notifications" require "active_support/notifications"
require_relative "explain_registry" require "active_record/explain_registry"
module ActiveRecord module ActiveRecord
class ExplainSubscriber # :nodoc: class ExplainSubscriber # :nodoc:

View file

@ -6,8 +6,8 @@ require "zlib"
require "set" require "set"
require "active_support/dependencies" require "active_support/dependencies"
require "active_support/core_ext/digest/uuid" require "active_support/core_ext/digest/uuid"
require_relative "fixture_set/file" require "active_record/fixture_set/file"
require_relative "errors" require "active_record/errors"
module ActiveRecord module ActiveRecord
class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc: class FixtureClassNotFound < ActiveRecord::ActiveRecordError #:nodoc:

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "scoping/default" require "active_record/scoping/default"
require_relative "scoping/named" require "active_record/scoping/named"
module ActiveRecord module ActiveRecord
# This class is used to create a table that keeps track of values and keys such # This class is used to create a table that keeps track of values and keys such

View file

@ -53,8 +53,8 @@ module ActiveRecord
# to avoid cross references when loading a constant for the # to avoid cross references when loading a constant for the
# first time. Also, make it output to STDERR. # first time. Also, make it output to STDERR.
console do |app| console do |app|
require_relative "railties/console_sandbox" if app.sandbox? require "active_record/railties/console_sandbox" if app.sandbox?
require_relative "base" require "active_record/base"
unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT) unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT)
console = ActiveSupport::Logger.new(STDERR) console = ActiveSupport::Logger.new(STDERR)
Rails.logger.extend ActiveSupport::Logger.broadcast console Rails.logger.extend ActiveSupport::Logger.broadcast console
@ -62,7 +62,7 @@ module ActiveRecord
end end
runner do runner do
require_relative "base" require "active_record/base"
end end
initializer "active_record.initialize_timezone" do initializer "active_record.initialize_timezone" do
@ -106,7 +106,7 @@ module ActiveRecord
initializer "active_record.warn_on_records_fetched_greater_than" do initializer "active_record.warn_on_records_fetched_greater_than" do
if config.active_record.warn_on_records_fetched_greater_than if config.active_record.warn_on_records_fetched_greater_than
ActiveSupport.on_load(:active_record) do ActiveSupport.on_load(:active_record) do
require_relative "relation/record_fetch_warning" require "active_record/relation/record_fetch_warning"
end end
end end
end end
@ -146,7 +146,7 @@ end_warning
# Expose database runtime to controller for logging. # Expose database runtime to controller for logging.
initializer "active_record.log_runtime" do initializer "active_record.log_runtime" do
require_relative "railties/controller_runtime" require "active_record/railties/controller_runtime"
ActiveSupport.on_load(:action_controller) do ActiveSupport.on_load(:action_controller) do
include ActiveRecord::Railties::ControllerRuntime include ActiveRecord::Railties::ControllerRuntime
end end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "active_support/core_ext/module/attr_internal" require "active_support/core_ext/module/attr_internal"
require_relative "../log_subscriber" require "active_record/log_subscriber"
module ActiveRecord module ActiveRecord
module Railties # :nodoc: module Railties # :nodoc:

View file

@ -189,7 +189,7 @@ db_namespace = namespace :db do
namespace :fixtures 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." 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 task load: [:environment, :load_config] do
require_relative "../fixtures" require "active_record/fixtures"
base_dir = ActiveRecord::Tasks::DatabaseTasks.fixtures_path base_dir = ActiveRecord::Tasks::DatabaseTasks.fixtures_path
@ -211,7 +211,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." # 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 task identify: [:environment, :load_config] do
require_relative "../fixtures" require "active_record/fixtures"
label, id = ENV["LABEL"], ENV["ID"] label, id = ENV["LABEL"], ENV["ID"]
raise "LABEL or ID required" if label.blank? && id.blank? raise "LABEL or ID required" if label.blank? && id.blank?
@ -237,7 +237,7 @@ db_namespace = namespace :db do
namespace :schema do namespace :schema do
desc "Creates a db/schema.rb file that is portable against any DB supported by Active Record" desc "Creates a db/schema.rb file that is portable against any DB supported by Active Record"
task dump: [:environment, :load_config] do task dump: [:environment, :load_config] do
require_relative "../schema_dumper" require "active_record/schema_dumper"
filename = ENV["SCHEMA"] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "schema.rb") filename = ENV["SCHEMA"] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, "schema.rb")
File.open(filename, "w:utf-8") do |file| File.open(filename, "w:utf-8") do |file|
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file) ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "batches/batch_enumerator" require "active_record/relation/batches/batch_enumerator"
module ActiveRecord module ActiveRecord
module Batches module Batches

View file

@ -124,11 +124,11 @@ module ActiveRecord
end end
end end
require_relative "predicate_builder/array_handler" require "active_record/relation/predicate_builder/array_handler"
require_relative "predicate_builder/base_handler" require "active_record/relation/predicate_builder/base_handler"
require_relative "predicate_builder/basic_object_handler" require "active_record/relation/predicate_builder/basic_object_handler"
require_relative "predicate_builder/range_handler" require "active_record/relation/predicate_builder/range_handler"
require_relative "predicate_builder/relation_handler" require "active_record/relation/predicate_builder/relation_handler"
require_relative "predicate_builder/association_query_value" require "active_record/relation/predicate_builder/association_query_value"
require_relative "predicate_builder/polymorphic_array_value" require "active_record/relation/predicate_builder/polymorphic_array_value"

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "../attribute" require "active_record/attribute"
module ActiveRecord module ActiveRecord
class Relation class Relation

View file

@ -1,9 +1,9 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "from_clause" require "active_record/relation/from_clause"
require_relative "query_attribute" require "active_record/relation/query_attribute"
require_relative "where_clause" require "active_record/relation/where_clause"
require_relative "where_clause_factory" require "active_record/relation/where_clause_factory"
require "active_model/forbidden_attributes_protection" require "active_model/forbidden_attributes_protection"
module ActiveRecord module ActiveRecord

View file

@ -2,7 +2,7 @@
require "active_support/core_ext/hash/except" require "active_support/core_ext/hash/except"
require "active_support/core_ext/hash/slice" require "active_support/core_ext/hash/slice"
require_relative "merger" require "active_record/relation/merger"
module ActiveRecord module ActiveRecord
module SpawnMethods module SpawnMethods

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "scoping/default" require "active_record/scoping/default"
require_relative "scoping/named" require "active_record/scoping/named"
module ActiveRecord module ActiveRecord
# This class is used to create a table that keeps track of which migrations # This class is used to create a table that keeps track of which migrations

View file

@ -101,7 +101,7 @@ module ActiveRecord
def error_class def error_class
if configuration["adapter"].include?("jdbc") if configuration["adapter"].include?("jdbc")
require_relative "../railties/jdbcmysql_error" require "active_record/railties/jdbcmysql_error"
ArJdbcMySQL::Error ArJdbcMySQL::Error
elsif defined?(Mysql2) elsif defined?(Mysql2)
Mysql2::Error Mysql2::Error

View file

@ -2,21 +2,21 @@
require "active_model/type" require "active_model/type"
require_relative "type/internal/timezone" require "active_record/type/internal/timezone"
require_relative "type/date" require "active_record/type/date"
require_relative "type/date_time" require "active_record/type/date_time"
require_relative "type/decimal_without_scale" require "active_record/type/decimal_without_scale"
require_relative "type/json" require "active_record/type/json"
require_relative "type/time" require "active_record/type/time"
require_relative "type/text" require "active_record/type/text"
require_relative "type/unsigned_integer" require "active_record/type/unsigned_integer"
require_relative "type/serialized" require "active_record/type/serialized"
require_relative "type/adapter_specific_registry" require "active_record/type/adapter_specific_registry"
require_relative "type/type_map" require "active_record/type/type_map"
require_relative "type/hash_lookup_type_map" require "active_record/type/hash_lookup_type_map"
module ActiveRecord module ActiveRecord
module Type module Type

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative "type_caster/map" require "active_record/type_caster/map"
require_relative "type_caster/connection" require "active_record/type_caster/connection"
module ActiveRecord module ActiveRecord
module TypeCaster # :nodoc: module TypeCaster # :nodoc:

View file

@ -86,8 +86,8 @@ module ActiveRecord
end end
end end
require_relative "validations/associated" require "active_record/validations/associated"
require_relative "validations/uniqueness" require "active_record/validations/uniqueness"
require_relative "validations/presence" require "active_record/validations/presence"
require_relative "validations/absence" require "active_record/validations/absence"
require_relative "validations/length" require "active_record/validations/length"