[Templates] Evaluate the var as a scalar

2010-01-02 Thread Octavian Râşniţă
Hi, I want to use a DBIx::Class resultset object in a TT template, but I am missing something and I can't get the correct value. I have a row object $user and I want to get the number of comments sent by that user from a related table named user_comment, using the relation user_comments. The p

Re: [Templates] Evaluate the var as a scalar

2010-01-03 Thread Oleg Kostyuk
[% number_of_comments = user.user_comments_rs.count %] * How do I use DBIx::Class objects in my TT templates? Like normal objects, mostly. However you need to watch out for TT calling methods in list context. When calling relationship accessors you will not get resultsets, but a list of all the re

Re: [Templates] Evaluate the var as a scalar

2010-01-03 Thread Octavian Rasnita
Thank you! I knew about search_rs and I use it, but I didn't know that I can add _rs to any relation that generate a resultset when is accessed. Octavian --- From: "Oleg Kostyuk" [% number_of_comments = user.user_comments_rs.count %] * How do I use DBIx::Class objects in my TT templates? Like