Module: ActiveRecord::LegacyYamlAdapter

Defined in:
lib/active_record/legacy_yaml_adapter.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Rails41, Rails420

Class Method Summary collapse

Class Method Details

.convert(klass, coder) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/active_record/legacy_yaml_adapter.rb', line 5

def self.convert(klass, coder)
  return coder unless coder.is_a?(Psych::Coder)

  case coder["active_record_yaml_version"]
  when 1, 2 then coder
  else
    ActiveSupport::Deprecation.warn(<<-MSG.squish)
      YAML loading from legacy format older than Rails 5.0 is deprecated
      and will be removed in Rails 6.2.
    MSG
    if coder["attributes"].is_a?(ActiveModel::AttributeSet)
      Rails420.convert(klass, coder)
    else
      Rails41.convert(klass, coder)
    end
  end
end