if those colons (":") are in the db, you have almost-readymade json.
-eric On Jan 5, 7:05 pm, Ukrit Himakoon <rails-mailing-l...@andreas-s.net> wrote: > rp8 -_- wrote: > > Ukrit Himakoon wrote: > >> rp8 -_- wrote: > >>> One way is to save a serialized hash into the db and you can deserialize > >>> the saved hash object back to params. > > >>> Regards, > > >>> rp8 > >>> ======================= > >>>http://lun.competo.com > > >> How to serialize would you mind giving me some example. > >> suppose that I've session['test'] which store several params inside > >> such as > >> session['test'] = idlist['1']=test&idlist['2']=test2 > > >> so I need to store this stuff inside my DB so if I need to serialized > >> what I have to do? > > require 'yaml' > > > serialized = obj.to_yaml > > new_obj = YAML::load(serialized) > > puts new_obj.width > > > Regards, > > > rp8 > > ======================= > >http://lun.competo.com > > Thx here's what's store inside my db for now > > ----------------------------------- > --- !map:HashWithIndifferentAccess > 2-Medium: "1" > "17": "1" > "18": "1" > 3-Low: "1" > 1-High: "1" > "20": "0" > "19": "1" > ----------------------------------- > > It's that correct one? if so how can I call this one back to > session['test'] ? > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---