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

2008-02-23 Thread Christopher Laco
"so, at the advice of claco, I" Oh shit. Someone listened to me. Be afraid. :-) -=Chris signature.asc Description: OpenPGP digital signature ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Se

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

2008-02-23 Thread Matt S Trout
On Tue, Feb 19, 2008 at 01:43:51PM -0500, Guillermo Roditi wrote: > > > 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 > > > > Don't those allow you to hav

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

2008-02-19 Thread Guillermo Roditi
> > 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 > > Don't those allow you to have a 'password' attribute stored in a > 'password_hash' column or similar now

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

2008-02-17 Thread Matt S Trout
On Thu, Feb 14, 2008 at 08:16:45PM -0500, Guillermo Roditi wrote: > > 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

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

2008-02-16 Thread Moritz Onken
Thanks, nice work. Works perfectly. Am 16.02.2008 um 18:37 schrieb Jay K: Hi There, I suppose now is as good a time as any - The Catalyst::Authentication::Store::DBIx::Class module currently on CPAN has the 'avoid the db hit' code is in it. It is not enabled by default, but add 'use_userdat

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

2008-02-16 Thread Jay K
Hi There, I suppose now is as good a time as any - The Catalyst::Authentication::Store::DBIx::Class module currently on CPAN has the 'avoid the db hit' code is in it. It is not enabled by default, but add 'use_userdata_from_session => 1' to your config and it will not reload from the database u

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

2008-02-16 Thread Moritz Onken
If someone tells me where to put that kind of code Matt suggested I'll write a patch and some (1? :-) ) tests. Am 15.02.2008 um 02:16 schrieb Guillermo Roditi: Which means the entire thing would be pointless. What you want to do really is $class->new({ %saved_stuff, -result_source => $sche

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

2008-02-14 Thread Guillermo Roditi
> 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_col

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

2008-02-14 Thread Jay K
Thanks for the suggestion, I will probably go that route. It's somewhat simpler than my previous plan. Jay On Feb 14, 2008, at 1:19 PM, Matt S Trout wrote: On Thu, Feb 14, 2008 at 11:06:09AM -0700, Jay K wrote: So why do I need to recovery the whole user row for every request? I could use $u

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

2008-02-14 Thread Matt S Trout
On Thu, Feb 14, 2008 at 11:06:09AM -0700, Jay K wrote: > >So why do I need to recovery the whole user row for every request? > >I could use > >$user_id = $c->session->{user_id}; > >@albums = $c->model('albums')->search({ user_id => $user_id }); > >as Mitchell suggested but I'd prefer to fetch the d

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

2008-02-14 Thread Jay K
So why do I need to recovery the whole user row for every request? I could use $user_id = $c->session->{user_id}; @albums = $c->model('albums')->search({ user_id => $user_id }); as Mitchell suggested but I'd prefer to fetch the data by using $c- >user because its the way one should do it. might i

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

2008-02-14 Thread Matt S Trout
On Thu, Feb 14, 2008 at 09:14:04AM +0100, Moritz Onken wrote: > > Am 14.02.2008 um 00:11 schrieb Jay K: > > >Hi there Moritz, > > > >The select by id that you are seeing is the retrieval of the user from > >the database when first recovering the user from the session. I am > >assuming that you a

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

2008-02-14 Thread Moritz Onken
Am 14.02.2008 um 00:11 schrieb Jay K: Hi there Moritz, The select by id that you are seeing is the retrieval of the user from the database when first recovering the user from the session. I am assuming that you are using the Catalyst::Authentication::Store::DBIx::Class storage module. Any a

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

2008-02-13 Thread Jay K
Hi there Moritz, The select by id that you are seeing is the retrieval of the user from the database when first recovering the user from the session. I am assuming that you are using the Catalyst::Authentication::Store::DBIx::Class storage module. Any access to $c->user will trigger this query

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

2008-02-13 Thread Mitchell Jackson
You don't have to do queries using relationship behavior if you don't like the way it works. For example: $user_id = $c->session->{user_id}; @albums = $c->model('albums')->search({ user_id => $user_id }); Mitch Moritz Onken wrote: Hi, I request all albums of a user by calling $c->user->alb

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

2008-02-13 Thread Moritz Onken
Hi, I request all albums of a user by calling $c->user->albums->all; That results in a query which retrieves the user id and then querys the album table with that user id in the where clause. It works, but how can I prevent that first query which retrieves the user id? Can't I store the use