Sha256: 0a3dafff87c59fdda94bb57f9b9f6785a3ac205f78c3e640ff34f641f5a84d96

Contents?: true

Size: 714 Bytes

Versions: 23

Compression:

Stored size: 714 Bytes

Contents

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

      case coder["active_record_yaml_version"]
      when 0 then coder
      else
        if coder["attributes"].is_a?(AttributeSet)
          coder
        else
          Rails41.convert(klass, coder)
        end
      end
    end

    module Rails41
      def self.convert(klass, coder)
        attributes = klass.attributes_builder
          .build_from_database(coder["attributes"])
        new_record = coder["attributes"][klass.primary_key].blank?

        {
          "attributes" => attributes,
          "new_record" => new_record,
        }
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
activerecord-4.2.11.3 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.11.2 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.11.1 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.11 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.10 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.10.rc1 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.9 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.9.rc2 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.9.rc1 lib/active_record/legacy_yaml_adapter.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activerecord-4.2.8/lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.8 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.8.rc1 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.7.1 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.7 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.7.rc1 lib/active_record/legacy_yaml_adapter.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.6 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.6.rc1 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.5.2 lib/active_record/legacy_yaml_adapter.rb
activerecord-4.2.5.1 lib/active_record/legacy_yaml_adapter.rb