Class: OTR::ActiveRecord::Shim

Inherits:
Object
  • Object
show all
Defined in:
lib/otr-activerecord/shim/v6.rb,
lib/otr-activerecord/shim/v7.rb

Overview

Compatibility layer for ActiveRecord 7

Instance Method Summary collapse

Constructor Details

#initializeShim

Returns a new instance of Shim.



5
6
7
# File 'lib/otr-activerecord/shim/v6.rb', line 5

def initialize
  ::ActiveRecord::Base.default_timezone = :utc
end

Instance Method Details

#force_db_test_env?Boolean

Force RACK_ENV/RAILS_ENV to be ‘test’ when running any db:test:* tasks

Returns:

  • (Boolean)


26
27
28
# File 'lib/otr-activerecord/shim/v6.rb', line 26

def force_db_test_env?
  false
end

#migration_base_class_nameObject

Basename of migration classes



20
21
22
23
# File 'lib/otr-activerecord/shim/v6.rb', line 20

def migration_base_class_name
  version = "6.#{::ActiveRecord::VERSION::MINOR}"
  "ActiveRecord::Migration[#{version}]"
end

#migrations_pathObject

The dir in which to put new migrations



15
16
17
# File 'lib/otr-activerecord/shim/v6.rb', line 15

def migrations_path
  OTR::ActiveRecord.migrations_paths[0]
end

#migrations_pathsObject

All db migration dir paths



10
11
12
# File 'lib/otr-activerecord/shim/v6.rb', line 10

def migrations_paths
  OTR::ActiveRecord.migrations_paths
end