Sha256: 863a39fad1b098601f98278a8676e87df28a7ccaa148eef9a487c6fc489559db

Contents?: true

Size: 507 Bytes

Versions: 14

Compression:

Stored size: 507 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

14 entries across 14 versions & 1 rubygems

Version Path
delayed_job-4.1.13 lib/delayed/serialization/active_record.rb
delayed_job-4.1.12 lib/delayed/serialization/active_record.rb
delayed_job-4.1.12.rc1 lib/delayed/serialization/active_record.rb
delayed_job-4.1.11 lib/delayed/serialization/active_record.rb
delayed_job-4.1.10 lib/delayed/serialization/active_record.rb
delayed_job-4.1.9 lib/delayed/serialization/active_record.rb
delayed_job-4.1.8 lib/delayed/serialization/active_record.rb
delayed_job-4.1.8.beta1 lib/delayed/serialization/active_record.rb
delayed_job-4.1.7 lib/delayed/serialization/active_record.rb
delayed_job-4.1.7.beta1 lib/delayed/serialization/active_record.rb
delayed_job-4.1.6 lib/delayed/serialization/active_record.rb
delayed_job-4.1.6.beta1 lib/delayed/serialization/active_record.rb
delayed_job-4.1.5 lib/delayed/serialization/active_record.rb
delayed_job-4.1.4 lib/delayed/serialization/active_record.rb