On Tue, Jun 19, 2007 at 12:58:10 -0400, John Goulah wrote:

If you do this:

>    my $myalums  = $c->model('MyDB::Alumni')->search({}, { rows => 20 }) ;

Then change this:

>   [% FOREACH alum IN alumni -%]

Into this:

        [% FOREACH alum IN alumni.all -%]

This gives you two big advantages IMHO:

        1. you can put resultset on the stash without paying for them
        with an SQL query. If the view chooses not to use this resultset
        (due to user prefs, feed variant, whatever) then the DB is never
        queried. This is easier to maintain and comes at a small
        performance overhead in comparison to making these decisions in
        the controller.

        2. subsequent actions can further filter the data set, or use it
        to create related resultsets. This encourages code reuse.

-- 
  Yuval Kogman <[EMAIL PROTECTED]>
http://nothingmuch.woobling.org  0xEBD27418

Attachment: pgppDLVOKOpHk.pgp
Description: PGP signature

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to