Ukrit Himakoon
2009-Jan-05 10:23 UTC
[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" --------------------------------------------------------- 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!! -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ukrit Himakoon
2009-Jan-06 01:57 UTC
Re: [Please help!]store parameters variable into database
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? -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ukrit Himakoon
2009-Jan-06 02:35 UTC
Re: [Please help!]store parameters variable into database
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.comHow 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? -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ukrit Himakoon
2009-Jan-06 03:05 UTC
Re: [Please help!]store parameters variable into database
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.comThx 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 via http://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
if those colons (":") are in the db, you have almost-readymade json.
-eric
On Jan 5, 7:05 pm, Ukrit Himakoon
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
http://significantbits.wordpress.com/2008/01/29/yaml-vs-marshal-performance/ --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---