Class: OTR::ActiveRecord::ShimBase

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

Overview

Base compatibility layer for ActiveRecord

Direct Known Subclasses

Shim

Instance Method Summary collapse

Constructor Details

#initializeShimBase

Returns a new instance of ShimBase.



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

def initialize
  ::ActiveRecord.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)


27
28
29
# File 'lib/otr-activerecord/shim/base.rb', line 27

def force_db_test_env?
  false
end

#migration_base_class_nameObject

Basename of migration classes



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

def migration_base_class_name
  major_v = ::ActiveRecord::VERSION::MAJOR
  minor_v = ::ActiveRecord::VERSION::MINOR
  "ActiveRecord::Migration[#{major_v}.#{minor_v}]"
end

#migrations_pathObject

The dir in which to put new migrations



15
16
17
# File 'lib/otr-activerecord/shim/base.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/base.rb', line 10

def migrations_paths
  OTR::ActiveRecord.migrations_paths
end