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 "arel"
require_relative "active_record/version"
require_relative "active_record/attribute_set"
require "active_record/version"
require "active_record/attribute_set"
module ActiveRecord
extend ActiveSupport::Autoload

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "attribute/user_provided_default"
require "active_record/attribute/user_provided_default"
module ActiveRecord
# 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/object/duplicable"
require "active_support/core_ext/class/subclasses"
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"
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"
module ActiveRecord #:nodoc:
# = Active Record

View file

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

View file

@ -1,11 +1,11 @@
# frozen_string_literal: true
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 "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 "arel/collectors/bind"
require "arel/collectors/composite"
require "arel/collectors/sql_string"

View file

@ -1,15 +1,15 @@
# frozen_string_literal: true
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_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 "active_support/core_ext/string/strip"

View file

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

View file

@ -1,27 +1,27 @@
# frozen_string_literal: true
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/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/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/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/type_map_initializer"
require "active_record/connection_adapters/postgresql/oid/type_map_initializer"
module ActiveRecord
module ConnectionAdapters

View file

@ -4,20 +4,20 @@
gem "pg", "~> 0.18"
require "pg"
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"
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"
module ActiveRecord
module ConnectionHandling # :nodoc:

View file

@ -1,13 +1,13 @@
# frozen_string_literal: true
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"
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"
gem "sqlite3", "~> 1.3.6"
require "sqlite3"

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "scoping/default"
require_relative "scoping/named"
require "active_record/scoping/default"
require "active_record/scoping/named"
module ActiveRecord
# 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
# first time. Also, make it output to STDERR.
console do |app|
require_relative "railties/console_sandbox" if app.sandbox?
require_relative "base"
require "active_record/railties/console_sandbox" if app.sandbox?
require "active_record/base"
unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT)
console = ActiveSupport::Logger.new(STDERR)
Rails.logger.extend ActiveSupport::Logger.broadcast console
@ -62,7 +62,7 @@ module ActiveRecord
end
runner do
require_relative "base"
require "active_record/base"
end
initializer "active_record.initialize_timezone" do
@ -106,7 +106,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_relative "relation/record_fetch_warning"
require "active_record/relation/record_fetch_warning"
end
end
end
@ -146,7 +146,7 @@ end_warning
# Expose database runtime to controller for logging.
initializer "active_record.log_runtime" do
require_relative "railties/controller_runtime"
require "active_record/railties/controller_runtime"
ActiveSupport.on_load(:action_controller) do
include ActiveRecord::Railties::ControllerRuntime
end

View file

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

View file

@ -189,7 +189,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_relative "../fixtures"
require "active_record/fixtures"
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."
task identify: [:environment, :load_config] do
require_relative "../fixtures"
require "active_record/fixtures"
label, id = ENV["LABEL"], ENV["ID"]
raise "LABEL or ID required" if label.blank? && id.blank?
@ -237,7 +237,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_relative "../schema_dumper"
require "active_record/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)

View file

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

View file

@ -124,11 +124,11 @@ module ActiveRecord
end
end
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/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/association_query_value"
require_relative "predicate_builder/polymorphic_array_value"
require "active_record/relation/predicate_builder/association_query_value"
require "active_record/relation/predicate_builder/polymorphic_array_value"

View file

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

View file

@ -1,9 +1,9 @@
# frozen_string_literal: true
require_relative "from_clause"
require_relative "query_attribute"
require_relative "where_clause"
require_relative "where_clause_factory"
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 "active_model/forbidden_attributes_protection"
module ActiveRecord

View file

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

View file

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "scoping/default"
require_relative "scoping/named"
require "active_record/scoping/default"
require "active_record/scoping/named"
module ActiveRecord
# 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
if configuration["adapter"].include?("jdbc")
require_relative "../railties/jdbcmysql_error"
require "active_record/railties/jdbcmysql_error"
ArJdbcMySQL::Error
elsif defined?(Mysql2)
Mysql2::Error

View file

@ -2,21 +2,21 @@
require "active_model/type"
require_relative "type/internal/timezone"
require "active_record/type/internal/timezone"
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/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/serialized"
require_relative "type/adapter_specific_registry"
require "active_record/type/serialized"
require "active_record/type/adapter_specific_registry"
require_relative "type/type_map"
require_relative "type/hash_lookup_type_map"
require "active_record/type/type_map"
require "active_record/type/hash_lookup_type_map"
module ActiveRecord
module Type

View file

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

View file

@ -86,8 +86,8 @@ module ActiveRecord
end
end
require_relative "validations/associated"
require_relative "validations/uniqueness"
require_relative "validations/presence"
require_relative "validations/absence"
require_relative "validations/length"
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"