datamapper / dm-serializer

DataMapper plugin for serializing Resources and Collections
http://datamapper.org/
MIT License
40 stars 44 forks source link

Deserialization support #33

Open blakeman8192 opened 11 years ago

blakeman8192 commented 11 years ago

It appears that dm-serializer can convert objects to xml/json/csv but not convert xml/json/csv back into objects. Often any time a program would want to serialize information into a database, it would at one point want to retrieve that same information. Why is dm-serializer part of a database project if it only accomplishes half of what a database does?

It seems more to be a simple serialization utility that can be used for a multitude of purposes... but not quite appropriate for database usage if it can't be used to retrieve information and only to store it. ActiveRecord has proper deserialization, so why can't DataMapper?

muescha commented 10 years ago

+1

dreamboostme commented 9 years ago

If I understand this correctly. Use this temporary solution

p = Post.first()

# get json as Hash
myjson = p.as_json

# deserialization
p.attributes = myjson