Forum: Ruby on Rails Serialized data

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
mafloria (Guest)
on 2009-01-08 01:34
(Received via mailing list)

I have a serialized Hash in a database. How can I acces my data? data
is stored as a varchar and text.
Glen (Guest)
on 2009-01-08 03:16
(Received via mailing list)
Did you use ActiveRecord's serialization?

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

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

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

Thank you,
This topic is locked and can not be replied to.