Skip to content

Commit

Permalink
passing tests for syck parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
thisduck committed Feb 24, 2012
1 parent ced39a7 commit 62def05
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/delayed/serialization/mongo_mapper.rb
@@ -1,18 +1,21 @@
# encoding: utf-8
if YAML.parser.class.name =~ /syck/i
MongoMapper::Document.class_eval do
@attributes_delayed = nil
yaml_as "tag:ruby.yaml.org,2002:MongoMapper"

def self.yaml_new(klass, tag, val)
val['attributes'] = val['attributes_delayed']
begin
klass.find(val['attributes']['_id'])
klass.find!(val['attributes']['_id'])
rescue MongoMapper::DocumentNotFound
raise Delayed::DeserializationError
end
end

def to_yaml_properties
['@attributes']
@attributes_delayed = self.attributes
['@attributes_delayed']
end
end
else
Expand Down

0 comments on commit 62def05

Please sign in to comment.