[Dbix-class] How to use order_by correctly

RA Jones ra.jones at dpw.clara.co.uk
Thu Apr 26 20:02:20 GMT 2007


Hi all,

How to change the order of rows returned from 
$c->model('Schema::MyTable')->all()?

$c->model('Schema::MyTable')->all({order_by => 'field'}) is ignored, and
$c->model('Schema::MyTable')->search({order_by => 'field'}) generates an 
error as the order_by phrase gets incorporated into the WHERE clause. 
Putting an undef before the hashref didn't do it either.

I'm currently achieving a field sort post-db retrieval using Sort::Key, 
but would like to nail my error for future use. Thanks.
-- 
Richard Jones
Leeds, UK




More information about the Dbix-class mailing list