0

I am using Grape and storing data in postgres hstore data field. But the problem is that it stores the Hashie::Mash as string and not as object.

   data_hash = {'top_key' => {'key1' => 'val1'}}
   db_obj = Model.find(1)
   db_obj.update_attributes(data: data_hash)

but after update if you fetch that object data field then it shows

   {"top_key"=>"#<Hashie::Mash key1=\"val1\">"}
Mr. Bless
  • 285
  • 4
  • 10

1 Answers1

0

Its due to the nested hash which hstore is unable to handle properly. After using nested-hstore gem problem got fixed.

Mr. Bless
  • 285
  • 4
  • 10