31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/delayed/psych_ext.rb', line 31
def accept(target)
if defined?(ActiveRecord::Base) && target.is_a?(ActiveRecord::Base)
tag = ['!ruby/ActiveRecord', target.class.name].compact.join(':')
map = @emitter.start_mapping(nil, tag, false, Psych::Nodes::Mapping::BLOCK)
register(target, map)
@emitter.scalar('attributes', nil, nil, true, false, Psych::Nodes::Mapping::ANY)
accept target.attributes.slice(target.class.primary_key)
@emitter.end_mapping
else
super
end
end
|