[Dbix-class] How to use order_by correctly
RA Jones
ra.jones at dpw.clara.co.uk
Thu Apr 26 20:26:26 GMT 2007
Justin Wheeler wrote:
> $c->model('Schema::MyTable')->search({}, { order_by => 'field' })->all();
OK thanks, I can't try it 'till tomorrow but it looks like it needed an
empty hashref not an undef variable. Typical, I tried everything but that.
> Justin
>
> On Thu, 26 Apr 2007, RA Jones wrote:
>
>> 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