Sha256: 0ae4b838f9f8dbe312e08672e89b884a1838b9378992fe34f231343cab1a5401

Contents?: true

Size: 506 Bytes

Versions: 10

Compression:

Stored size: 506 Bytes

Contents

if defined?(ActiveRecord)
  module ActiveRecord
    class 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
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
delayed_job-4.1.3 lib/delayed/serialization/active_record.rb
delayed_job-4.1.2 lib/delayed/serialization/active_record.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.1.1/lib/delayed/serialization/active_record.rb
delayed_job-4.1.1 lib/delayed/serialization/active_record.rb
delayed_job-4.1.0 lib/delayed/serialization/active_record.rb
delayed_job_tgmerritt-4.0.7 lib/delayed/serialization/active_record.rb
delayed_job-4.0.6 lib/delayed/serialization/active_record.rb
delayed_job-4.0.5 lib/delayed/serialization/active_record.rb
delayed_job-4.0.4 lib/delayed/serialization/active_record.rb
delayed_job-4.0.3 lib/delayed/serialization/active_record.rb