[Catalyst] Order_by
Doran L. Barton
fozz at iodynamics.com
Thu Mar 22 22:15:11 GMT 2007
Not long ago, Michael Higgins proclaimed...
> Having worked through the tutorial with success, now, I need to make my
> application.
>
> First question for which I can't seem to find an answer (of many to come, I
> fear), is how and where does one "order by" the results?
>
> I am returning all the 'books', say (tutorial reference), but I'd like them
> ordered.
>
> Where is that indicated?
>
> Sorry for the newbie question. Someday, I'll be an oldbie, I'm sure.
This is really a DBIC question... but it's like this:
my @books = $c->model('My::AppDB::Book')->search(
{ num_pages => { '>=', $pages }},
{ order_by => 'title'});
Basically, the order_by is the second argument to the search() function.
See: 'perldoc DBIx::Class::ResultSet'.
-=Fozz
--
fozz at iodynamics.com is Doran L. Barton, president/CTO, Iodynamics LLC
Iodynamics: IT and Web services by Linux/Open Source specialists
"Milk drinkers are turning to powder"
-- Headline seen in newspaper
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070322/649e2a18/attachment.pgp
More information about the Catalyst
mailing list