Hi,
I have a serialized Hash in a database. How can I acces my data? data
is stored as a varchar and text.
Hi,
I have a serialized Hash in a database. How can I acces my data? data
is stored as a varchar and text.
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs