[Catalyst] $c->user->some_relationship always retrives user id from the db

Guillermo Roditi groditi at gmail.com
Fri Feb 15 01:16:45 GMT 2008


>  Which means the entire thing would be pointless. What you want to do
>  really is
>
>   $class->new({ %saved_stuff, -result_source => $schema->source($class) });
>   $new_obj->in_storage(1);
>
>  then it'll work "as if" you re-fetched the object (%saved_stuff being the
>  return of $obj->get_columns). Making stuff work with only the PK stashed
>  in the session is left as an exercise to the reader, but would probably
>  be best done using Data::Thunk and Data::Swap.


/me confoos. Why not just use the shiny new freeze / thaw hooks?
Wouldn't it make sense to store a frozen version of the User row /
object in the session and then thaw it upon request? This seems like
it would be a really natural way to cache this information. Ideally,
the thawing would be a lazy operation as well  i think.

I just bring this up because the code you just sent would not work
when one is using things like DigestColumns or EncodedColumn, which
are most commonly seen in User-type objects

--Guillermo Roditi (groditi)



More information about the Catalyst mailing list