class ActiveRecord::Base
Public Class Methods
yaml_new(klass, tag, val)
click to toggle source
# File lib/queue_dispatcher/serialization/active_record.rb, line 5 def self.yaml_new(klass, tag, val) if ActiveRecord::VERSION::MAJOR == 3 klass.unscoped.find(val['attributes'][klass.primary_key]) else # Rails 2 klass.with_exclusive_scope { klass.find(val['attributes'][klass.primary_key]) } end rescue ActiveRecord::RecordNotFound #raise QueueDispatcher::DeserializationError, "ActiveRecord::RecordNotFound, class: #{klass} , primary key: #{val['attributes'][klass.primary_key]} " '----- QueueDispatcher::DeserializationError -----' end
Public Instance Methods
encode_with(coder)
click to toggle source
serialize to YAML
# File lib/queue_dispatcher/psych_ext.rb, line 4 def encode_with(coder) coder["attributes"] = @attributes coder.tag = ['!ruby/ActiveRecord', self.class.name].join(':') end
to_yaml_properties()
click to toggle source
# File lib/queue_dispatcher/serialization/active_record.rb, line 16 def to_yaml_properties ['@attributes'] end