Module: ActiveRecord::Migration::Compatibility

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

Overview

:nodoc: all

Defined Under Namespace

Modules: FourTwoShared, Legacy Classes: V4_2

Constant Summary collapse

V5_0 =
Current

Class Method Summary collapse

Class Method Details

.find(version) ⇒ Object


4
5
6
7
8
9
10
11
12
# File 'activerecord/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