File: base.rb

package info (click to toggle)
ruby-otr-activerecord 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 340 kB
  • sloc: ruby: 562; sh: 133; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module OTR
  module ActiveRecord
    # Base compatibility layer for ActiveRecord
    class ShimBase
      def initialize
        ::ActiveRecord.default_timezone = :utc
      end

      # All db migration dir paths
      def migrations_paths
        OTR::ActiveRecord.migrations_paths
      end

      # The dir in which to put new migrations
      def migrations_path
        OTR::ActiveRecord.migrations_paths[0]
      end

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

      # Force RACK_ENV/RAILS_ENV to be 'test' when running any db:test:* tasks
      def force_db_test_env?
        false
      end
    end
  end
end