I use Catalyst and put a resultset into the stash for TT to access:
$c->stash->{tournament} = $c->model('DB::Tournament')->find($id);
This class has a relationship with “tournament_participant” which I access from inside a TT page like this:
[% FOREACH participant IN tournament.tournament_participants -%]
problem is, I want to sort the result by a column like this:
[% FOREACH participant IN tournament.tournament_participants.search( {}, { sort_by => 'position' } ) -%]
but the above does not work (nothing is returned). Is this possible to do?
This should do the trick (assuming the relationship really is
tournament_participants(which seems a little redundant and ungainly;tournament.participantsfeels more natural and is easy to change in the result class if desired)–Doc: DBIx::Class::Relationship::Base.