Sha256: efaac57113299c21ca3073b4b52ebdb7b0b5986e493b775bd405350f8c214d2f

Contents?: true

Size: 470 Bytes

Versions: 7

Compression:

Stored size: 470 Bytes

Contents

if defined?(ActiveRecord)
  class ActiveRecord::Base
    yaml_as "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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
delayed_job-4.0.2 lib/delayed/serialization/active_record.rb
delayed_job-4.0.1 lib/delayed/serialization/active_record.rb
delayed_job-4.0.0 lib/delayed/serialization/active_record.rb
delayed_job-4.0.0.beta2 lib/delayed/serialization/active_record.rb
delayed_job-4.0.0.beta1 lib/delayed/serialization/active_record.rb
delayed_job-3.0.5 lib/delayed/serialization/active_record.rb
delayed_job-3.0.4 lib/delayed/serialization/active_record.rb