Hopefully there is a quick and obvious answer to the following - if so, apologies for the length of this email. Apologies in advance also if this is considered off-topic and/or covered in previous threads - I have trawled around for a while (and recently got Jonathan's book !) but all my solutions seem a bit like hacks and I'm hoping for a "Best Practice".
My problem: given a row from table A, I would like to be able to return related entries from table B ideally from within a template (unless this is committing some kind of MVC heresy), I was thinking something like the following: Controller/TableA.pm: $c->{stash}->{row_a} = $c->model('MyDBIC::TableA')->find('id'); $c->{stash}->{template} = 'view_a.tt2'; $c->forward('Catalyst::View::TT'); /root/src/view_a.tt2: [% rows_b = row_a.get_related_rows( optional => param ) %] [% FOREACH row_b = rows_b %] [% DisplayRow(row_b) %] [% END %] However, there is a reasonable amount of logic required to get the related rows - the relationship between A and B is too complicated to encapsulate in a static "has_many" (especially with the optional params) so I can't use "row_a.search_related()". Assuming this is the case (rather than my DBIC incompetence): 1) where is the best place to put this logic? (Controller::ModelA.pm, DBIC:: ModelA.pm, ResultSet::ModelA.pm??) 2) following from 1) what is the best way of accessing this logic from the template? Many thanks, Ian
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/