[CDBI] Using freeze/thaw to munge a column value.

[prev] [thread] [next] [Date index for 2005/10/24]

From: George Hartzell
Subject: [CDBI] Using freeze/thaw to munge a column value.
Date: 18:45 on 24 Oct 2005
This should be simple, but I'm having a brain freeze or something....

I want to create a simple class that maps to a two-column table, with
a key and a value (something to pass args around in Mason components,
since sessions don't behave well).

I want both to be strings, the key is something meaningful to me, and
the value is a frozen (Storable::freeze) hash of the args (I can make
sure it'll freeze/thaw ok).

I can't use has_a and {in,de}flate because it's not an object.

I have a feeling that I can use some combination of before_update,
after_set_value, select, and before_create hooks, but I'm not
convinced I know just when each comes into play.

At this point I'm just freezing and thawing in the app code, but I'd
like to hide it better....

Does anyone have a simpleton's example?

Thanks,

g.


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Using freeze/thaw to munge a column value.
George Hartzell 18:45 on 24 Oct 2005

Re: [CDBI] Using freeze/thaw to munge a column value.
George Hartzell 18:10 on 25 Oct 2005

Generated at 14:18 on 27 Oct 2005 by mariachi v0.52