I am saving one field as string in my model, so after that i tried via console
1.9.3-p547 :250 > s1 = s.send_details
=> "---\nnew_order: order\nprogress: order on d way\ndelivered:\n
message: delivered\n send_after: '1'\n"
1.9.3-p547 :255 > JSON.parse(s1)
JSON::ParserError: 757: unexpected token at '---
'
1.9.3-p547 :262 > s1.class
=> String
i am trying to convert this to json or hash, because i need to take the values from that, is there any way to do this?
send_detailswith ajsonor ahash, instead of parsing it afterwards.serialize :send_detailsto the model should serialize (and deserialize) the attribute automatically, see api.rubyonrails.org/classes/ActiveRecord/AttributeMethods/…