Class: OTR::ActiveRecord::Shim
- Inherits:
-
Object
- Object
- OTR::ActiveRecord::Shim
- Defined in:
- lib/otr-activerecord/shim/v6.rb,
lib/otr-activerecord/shim/v7.rb
Overview
Compatibility layer for ActiveRecord 7
Instance Method Summary collapse
-
#force_db_test_env? ⇒ Boolean
Force RACK_ENV/RAILS_ENV to be ‘test’ when running any db:test:* tasks.
-
#initialize ⇒ Shim
constructor
A new instance of Shim.
-
#migration_base_class_name ⇒ Object
Basename of migration classes.
-
#migrations_path ⇒ Object
The dir in which to put new migrations.
-
#migrations_paths ⇒ Object
All db migration dir paths.
Constructor Details
#initialize ⇒ Shim
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
26 27 28 |
# File 'lib/otr-activerecord/shim/v6.rb', line 26 def force_db_test_env? false end |
#migration_base_class_name ⇒ Object
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_path ⇒ Object
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_paths ⇒ Object
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 |