Storing hashes in DB but getting strings back


#1

Hi!
I am adding a hash to a serialized column in a DB. When retrieving the
data I get back a string though… Any idea why that might happen?

Here is the model and a copy and paste of the usage from irb:
http://pastie.caboo.se/58220

Hope you have any ideas!

Best regards
Sebastian


#2

I solved the problem.
Never mind.
I had written the serialize statement wrong.

I had written:
serialize :name1, :name2

but writing
serialize :name1, Hash
serialize :name2, Hash

solved the problem.
Tralala!

Thanks

S

Sebastian probst Eide wrote:

Hi!
I am adding a hash to a serialized column in a DB. When retrieving the
data I get back a string though… Any idea why that might happen?

Here is the model and a copy and paste of the usage from irb:
http://pastie.caboo.se/58220

Hope you have any ideas!

Best regards
Sebastian