Class ActiveRecord::Base
In: lib/delayed/psych_ext.rb
lib/delayed/serialization/active_record.rb
Parent: Object

Methods

Public Class methods

[Source]

    # File lib/delayed/serialization/active_record.rb, line 5
 5:     def self.yaml_new(klass, tag, val)
 6:       if ActiveRecord::VERSION::MAJOR == 3
 7:         klass.unscoped.find(val['attributes'][klass.primary_key])
 8:       else # Rails 2
 9:         klass.with_exclusive_scope { klass.find(val['attributes'][klass.primary_key]) }
10:       end
11:     rescue ActiveRecord::RecordNotFound
12:       raise Delayed::DeserializationError, "ActiveRecord::RecordNotFound, class: #{klass} , primary key: #{val['attributes'][klass.primary_key]} "
13:     end

Public Instance methods

serialize to YAML

[Source]

   # File lib/delayed/psych_ext.rb, line 4
4:     def encode_with(coder)
5:       coder["attributes"] = @attributes
6:       coder.tag = ['!ruby/ActiveRecord', self.class.name].join(':')
7:     end

[Source]

    # File lib/delayed/serialization/active_record.rb, line 15
15:     def to_yaml_properties
16:       ['@attributes']
17:     end

[Validate]