Sha256: 8794b3d84a5b00d43b4bb3767e39c4c6b045521f2231b0df50caa55a2e44686e

Contents?: true

Size: 521 Bytes

Versions: 11

Compression:

Stored size: 521 Bytes

Contents

if defined?(ActiveRecord)
  module ActiveRecord
    class Base
      yaml_tag 'tag:ruby.yaml.org,2002:ActiveRecord'

      def self.yaml_new(klass, _tag, val)
        klass.unscoped.find(val['attributes'][klass.primary_key])
      rescue ActiveRecord::RecordNotFound
        raise Delayed::DeserializationError,
              "ActiveRecord::RecordNotFound, class: #{klass} , primary key: #{val['attributes'][klass.primary_key]}"
      end

      def to_yaml_properties
        ['@attributes']
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
delayed-0.5.5 lib/delayed/serialization/active_record.rb
delayed-0.5.4 lib/delayed/serialization/active_record.rb
delayed-0.5.3 lib/delayed/serialization/active_record.rb
delayed-0.5.2 lib/delayed/serialization/active_record.rb
delayed-0.5.1 lib/delayed/serialization/active_record.rb
delayed-0.5.0 lib/delayed/serialization/active_record.rb
delayed-0.4.0 lib/delayed/serialization/active_record.rb
delayed-0.3.0 lib/delayed/serialization/active_record.rb
delayed-0.2.0 lib/delayed/serialization/active_record.rb
delayed-0.1.1 lib/delayed/serialization/active_record.rb
delayed-0.1.0 lib/delayed/serialization/active_record.rb