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

George Hartzell hartzell at kestrel.alerce.com
Mon Oct 24 19:45:17 BST 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?



More information about the ClassDBI mailing list