On Mon, 2006-07-31 at 22:37 -0700, Mark Blythe wrote:
> This is slightly off-topic, but since I'm running into this problem
> while using Catalyst, I'm hoping that others on the list may have
> already solved it.
> 
> I was writing a simple template today, using TT + DBIC.  I had an
> object and was exercising a has_many relationship.  I simply wanted to
> see if any rows had been returned.  It seemed simple enough:
> 
> [% SET children = parent.children %]
> [% IF children.list.size %]
> ...
> [% END %]

How about 
  [% SET children = [ parent.children ] %]
or 
  [% SET children = [ parent.children.all ] %]

[I'm not sure how the .all - which forces it to return an array of rows
- plays with a prefetch in the original query... which would seem like a
good idea if you are definitely going to use that relationship]

        Nigel.

-- 
[ Nigel Metheringham           [EMAIL PROTECTED] ]
[ - Comments in this message are my own and not ITO opinion/policy - ]


_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to