Module: ActiveRecord::Migration::Compatibility

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

Overview

:nodoc: all

Defined Under Namespace

Classes: V4_2, V5_0

Constant Summary collapse

V5_1 =
Current

Class Method Summary collapse

Class Method Details

.find(version) ⇒ Object



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

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