order by not working on all

Car.all.order("make") generates an error like "undefined method `order'
for #<Array:0x7fd314476e38>"

Is this a bug? It seems that it should work. Rails 3.0.0rc.

Car.order("make").all

Greg Donald wrote:

Car.order("make").all
--
Greg Donald
destiney.com | gregdonald.com

Thank you! :slight_smile: It seems odd considering that Car.where(blah
blah).order('make') works.

Mark Horrocks

Mark Horrocks wrote:

Greg Donald wrote:

Car.order("make").all
--
Greg Donald
destiney.com | gregdonald.com

Thank you! :slight_smile: It seems odd considering that Car.where(blah
blah).order('make') works.

If I understand it right you don't need the "all" part at all:

Car.order("make")

The way I understand it "all" is a special method designed to get "all"
records in a similar way as all was in the old syntax.

In other words:

Car.find(:all, :order => 'make') not the same as Car.all

Robert Walker wrote:

>
Car.order("make")

The way I understand it "all" is a special method designed to get "all"
records in a similar way as all was in the old syntax.

In other words:

Car.find(:all, :order => 'make') not the same as Car.all

Ah yes, that would take advantage of the lazy loading I think. And the
syntax makes more sense. Thanks.

Mark