Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer require_relative for internal requires #331

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'chrono_model'
require_relative '../../chrono_model'

module ActiveRecord
# TODO: Remove when dropping Rails < 7.2 compatibility
Expand Down
20 changes: 10 additions & 10 deletions lib/chrono_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

require 'active_record'

require 'chrono_model/chrono'
require 'chrono_model/conversions'
require 'chrono_model/patches'
require 'chrono_model/adapter'
require 'chrono_model/time_machine'
require 'chrono_model/time_gate'
require 'chrono_model/version'

require 'chrono_model/railtie' if defined?(Rails::Railtie)
require 'chrono_model/db_console' if defined?(Rails::DBConsole) && Rails.version < '7.1'
require_relative 'chrono_model/chrono'
require_relative 'chrono_model/conversions'
require_relative 'chrono_model/patches'
require_relative 'chrono_model/adapter'
require_relative 'chrono_model/time_machine'
require_relative 'chrono_model/time_gate'
require_relative 'chrono_model/version'

require_relative 'chrono_model/railtie' if defined?(Rails::Railtie)
require_relative 'chrono_model/db_console' if defined?(Rails::DBConsole) && Rails.version < '7.1'

module ChronoModel
class Error < ActiveRecord::ActiveRecordError # :nodoc:
Expand Down
10 changes: 5 additions & 5 deletions lib/chrono_model/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

require 'active_record/connection_adapters/postgresql_adapter'

require 'chrono_model/adapter/migrations'
require 'chrono_model/adapter/migrations_modules/stable'
require_relative 'adapter/migrations'
require_relative 'adapter/migrations_modules/stable'

require 'chrono_model/adapter/ddl'
require 'chrono_model/adapter/indexes'
require 'chrono_model/adapter/upgrade'
require_relative 'adapter/ddl'
require_relative 'adapter/indexes'
require_relative 'adapter/upgrade'

module ChronoModel
# This class implements all ActiveRecord::ConnectionAdapters::SchemaStatements
Expand Down
2 changes: 1 addition & 1 deletion lib/chrono_model/db_console.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

require 'chrono_model/patches/db_console'
require_relative 'patches/db_console'

Rails::DBConsole.prepend ChronoModel::Patches::DBConsole::DbConfig
14 changes: 7 additions & 7 deletions lib/chrono_model/patches.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require 'chrono_model/patches/as_of_time_holder'
require 'chrono_model/patches/as_of_time_relation'
require_relative 'patches/as_of_time_holder'
require_relative 'patches/as_of_time_relation'

require 'chrono_model/patches/join_node'
require 'chrono_model/patches/relation'
require 'chrono_model/patches/preloader'
require 'chrono_model/patches/association'
require 'chrono_model/patches/batches'
require_relative 'patches/join_node'
require_relative 'patches/relation'
require_relative 'patches/preloader'
require_relative 'patches/association'
require_relative 'patches/batches'
2 changes: 1 addition & 1 deletion lib/chrono_model/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'active_record/tasks/chronomodel_database_tasks'
require_relative '../active_record/tasks/chronomodel_database_tasks'

module ChronoModel
class Railtie < ::Rails::Railtie
Expand Down
6 changes: 3 additions & 3 deletions lib/chrono_model/time_machine.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require 'chrono_model/time_machine/time_query'
require 'chrono_model/time_machine/timeline'
require 'chrono_model/time_machine/history_model'
require_relative 'time_machine/time_query'
require_relative 'time_machine/timeline'
require_relative 'time_machine/history_model'

module ChronoModel
module TimeMachine
Expand Down