Re: [Catalyst] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-07 Thread Matt S Trout
On Fri, Jul 06, 2007 at 09:30:38PM -0700, apv wrote:
 False alarm. I figured it out. Have to prefetch relationships when  
 putting the user into the session at login or the goodies just ain't  
 in the session info.

The user object is re-retrieved by the auth plugin anyway, so

$c-user-obj-votes

will work.

if you're storing a 'user' object in the session, something like

$c-session-{user}-result_source($c-model('DB')-schema-source('User'));

will restore the result source.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-07 Thread apv
Thanks Matt. That is much better. Stuffing the session with a ton of  
data up front didn't strike me as a good idea.



On Jul 7, 2007, at 7:11 AM, Matt S Trout wrote:


On Fri, Jul 06, 2007 at 09:30:38PM -0700, apv wrote:

False alarm. I figured it out. Have to prefetch relationships when
putting the user into the session at login or the goodies just ain't
in the session info.


The user object is re-retrieved by the auth plugin anyway, so

$c-user-obj-votes

will work.

if you're storing a 'user' object in the session, something like

$c-session-{user}-result_source($c-model('DB')-schema-source 
('User'));


will restore the result source.

--
  Matt S Trout   Need help with your Catalyst or  
DBIx::Class project?
   Technical DirectorWant a managed development or deployment  
platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk  
for a quote
http://chainsawblues.vox.com/ http:// 
www.shadowcatsystems.co.uk/



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-06 Thread apv
So, in my template I have this and it works fine if I assign user,  
a DBIC object, to the stash from the controller.


 [% user.votes %]

But if I do this to get the user inside the template:

 [% user = Catalyst.session.user %]
 [% user.votes %]

I get this fatal error:

 Couldn't render template undef error - Can't call method source  
on an
 undefined value at /Library/Perl/5.8.6/DBIx/Class/ 
ResultSourceHandle.pm line 62.


I can get all of user's regular columns fine, like email, username,  
etc. Just not any of its relationships without the fatal.


Seems like it's not a session specific issue (both FastMmap and File  
engines fail the same way).


Any ideas?


-Ashley

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-06 Thread apv
False alarm. I figured it out. Have to prefetch relationships when  
putting the user into the session at login or the goodies just ain't  
in the session info.



–Ashley
--


On Jul 6, 2007, at 7:04 PM, apv wrote:

So, in my template I have this and it works fine if I assign  
user, a DBIC object, to the stash from the controller.


 [% user.votes %]

But if I do this to get the user inside the template:

 [% user = Catalyst.session.user %]
 [% user.votes %]

I get this fatal error:

 Couldn't render template undef error - Can't call method source  
on an
 undefined value at /Library/Perl/5.8.6/DBIx/Class/ 
ResultSourceHandle.pm line 62.


I can get all of user's regular columns fine, like email, username,  
etc. Just not any of its relationships without the fatal.


Seems like it's not a session specific issue (both FastMmap and  
File engines fail the same way).


Any ideas?




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/