Module: ActiveRecord::Migration::Compatibility

Defined in:
lib/active_record/migration/compatibility.rb

Overview

:nodoc: all

Defined Under Namespace

Classes: V4_2, V5_0, V5_1

Constant Summary collapse

V5_2 =
Current

Class Method Summary collapse

Class Method Details

.find(version) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/active_record/migration/compatibility.rb', line 6

def self.find(version)
  version = version.to_s
  name = "V#{version.tr('.', '_')}"
  unless const_defined?(name)
    versions = constants.grep(/\AV[0-9_]+\z/).map { |s| s.to_s.delete("V").tr("_", ".").inspect }
    raise ArgumentError, "Unknown migration version #{version.inspect}; expected one of #{versions.sort.join(', ')}"
  end
  const_get(name)
end