[Please help!]store parameters variable into database

So here's what I'm trying to do I'm going to store params variables into database. Here's what it's looklike.

------------------------Data that store on my database -------------- --- !map:HashWithIndifferentAccess "15": "1" "16": "1" 2-Medium: "0" 1-High: "1" 3-Low: "0"

Ukrit Himakoon wrote:

So here's what I'm trying to do I'm going to store params variables into database. Here's what it's looklike.

------------------------Data that store on my database -------------- --- !map:HashWithIndifferentAccess "15": "1" "16": "1" 2-Medium: "0" 1-High: "1" 3-Low: "0" ---------------------------------------------------------

So I need to call this parameter from database then pass it on the page once again But It's not like the previous parameter so any idea?

Please help!!

I'm still confused with this problem I wonder that,Can I convert this kind of variables back to params?

One way is to save a serialized hash into the db and you can deserialize the saved hash object back to params.

Regards,

rp8

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?

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

if those colons (":") are in the db, you have almost-readymade json.

-eric