On 5/6/07, Tom V. <ruby-talk / hinv.org> wrote:
> Hi Stefano,
>
> it's not working for me.
> MyClass.const_get always returns a NameError.
> Trying:
>
> MyClass.const_defined?(session[:constant_name])
>
> always returns 'false'
> (except for the method where constant_name was defined...).
>
> My guess is that 'session' cannot store Constants created the way I do it.
> However, storing other large and complex objects is not a problem.

You guess is in the territory, but it's not really about session's
capability. if xyz_method is a controller action for instance, and
abc_method is a controller action, there's nothing guaranteeing per se
that you're state is going to be persisted between user interactions
with the web app. What you really need to store in session is the name
of the constant, AND it's value. and then you need to const_set it at
the beginning of every method where you make use of this live tree
thing.
> >
>
>