force resultset as array
"Spevak, Martin" <[email protected]> Fri, 18 Oct 2013 11:03:21 +0000
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I have small problem with TT while getting DBIx::ResultSet. For instance
I have stash variable team which ich DBIx::Result (one entry). In DBIx
exists relations team_accesses as has_many. So in TT I am using:
team_accesses = team.team_accesses;
Problem is:
when team has no accesses, variable team_accesses is empty string ('')
when 1 access exists, variable contain hash which is result
DBIx::TeamAccess.
when exists more than 1 access, variable contains array of
DBIx::TreamAccess.
Is the way how to say TT, that result needs to be converted to array?
I tried: team_access = [ team.team_accesses ], but my results are,
[ '' ], [DBIx::Result], [[DBIx::Result]]
Thanks for help