[Dbix-class] 0.05 - small gotcha

Alan Humphrey alan.humphrey at comcast.net
Thu Feb 2 18:44:03 CET 2006


In my Catalyst app I used to be able to do this:

 

  my $items = $c->model('Staging')->class('BirdingSites')->search({},

                                                                       {

                                                                        rows
=> 10,

 
order_by => 'site_name'

                                                                        });

 

$items would have a nice pager object for me to work with.  No longer.  If I
try to do

 

$items->pager->current_page( $page_num )

 

I get an error:

 

Caught exception in BirdWeb::Admin::C::Sites->list
"DBIx::Class::ResultSet::pager(): Can't create pager for non-paged rs at
/home/alanh/birdweb/trunk/BirdWeb-Admin/script/../lib/BirdWeb/Admin/C/Sites.
pm line 28"

 

The solution is to add the page attribute:

 

  my $items = $c->model('Staging')->class('BirdingSites')->search({},

                                                                       {

                                                                        page
=> $page_num,

                                                                        rows
=> 10,

 
order_by => 'site_name'

                                                                        });

 

Not a big deal.  Thought I'd mention it in case someone else encounters it.

 

- Alan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20060202/8054a341/attachment-0001.htm


More information about the Dbix-class mailing list