[Catalyst] updating $c->user at runtime
Yuval Kogman
nothingmuch at woobling.org
Tue Feb 7 11:41:42 CET 2006
On Tue, Feb 07, 2006 at 11:21:35 +0100, Wijnand Wiersma wrote:
> Good morning!
>
> Op 7-feb-2006, om 8:09 heeft Yuval Kogman het volgende geschreven:
>
> >On Tue, Feb 07, 2006 at 00:57:28 +0100, Wijnand Wiersma wrote:
> >>Hi all,
> >>When the user has updated his profile I immediately display a summary of his profile again.
> >>In this template I use c.user.user.name etc to display the values. But after editing the profile I get the old values there.
> >>Is it possible to set $c->user again after editing? I don't want to add a second template or duplicate code.
> >How did you update the profile? Please paste code.
> >You should update using $c->user->user itself - that way it should
> >be up to date.
>
> Aha, I retrieved a DBIc object from the database and updated that.
>
> $person = $c->model('DBIC')->table('person')->search(
> username => $c->user->user->username(),
> );
> $person->update($valid_results);
>
> Is it possible to do something this quick with $c->user->user ?
$person and $c->user->user are essentially the same thing here.
It's as if you just did
$person = $model->search(
username => $person->username,
);
As on #dbix-class about something like Class::DBI's live object
cache.
--
() Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418 perl hacker &
/\ kung foo master: /me has realultimatepower.net: neeyah!!!!!!!!!!!!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060207/8d77c5d1/attachment.pgp
More information about the Catalyst
mailing list