# Serialized data

**URL:** <https://www.ruby-forum.com/t/serialized-data/157162>\
**Category:** Rails\
**Created:** [January 8, 2009, 12:34am UTC](https://www.ruby-forum.com/t/serialized-data/157162 "2009-01-08T00:34:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mafloria](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@mafloria](https://www.ruby-forum.com/u/mafloria)\
**Post date:** [January 8, 2009, 12:34am UTC](https://www.ruby-forum.com/t/serialized-data/157162/1 "2009-01-08T00:34:52Z")

</div>

Hi,

I have a serialized Hash in a database. How can I acces my data? data  
is stored as a varchar and text.

---

<div class="post-metadata">

**Author:** ![mafloria](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@mafloria](https://www.ruby-forum.com/u/mafloria)\
**Post date:** [January 8, 2009, 2:16am UTC](https://www.ruby-forum.com/t/serialized-data/157162/2 "2009-01-08T02:16:40Z")

</div>

Did you use ActiveRecord’s serialization?

class MyModel \< ActiveRecord::Base  
serialize :data, Hash  
end

If so, you can simple call from your model to get your hash back.

mymodel = MyModel.find(prams[:id])  
myhash = mymodel.data  
field1 = myhash[:field1]

Thank you,  
Glen
