:include breaks has_many :order

It would appear that using :include on a model that has_many with an
:order on another model makes it so that the order is ignored. Is this
supposed to happen? Strikes me as odd behavior.

For example

class Farmer < ActiveRecord::Base
has_many :cows, :order => ‘position’
end

class Cow < ActiveRecord::Base
acts_as_list :scope => :farmer
end

If I do Farmer.find(:first).cows I get the correct cow order.

If I do Farmer.find(:first, :include => ‘cows’) then I get the wrong
cow order.

Any insight into if this is a bug or intended behavior would be great.

Matthew M.
blog.mattmargolis.net

On Jul 1, 2006, at 7:33 PM, Matthew M. wrote:

class Cow < ActiveRecord::Base

Matthew M.
blog.mattmargolis.net

There is a recent patch to fix this here:

http://dev.rubyonrails.org/ticket/3438

-Ezra

Ezra Z. wrote:

has_many :cows, :order => ‘position’
wrong cow order.

-Ezra


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Great. Thank you.

Matthew M.
blog.mattmargolis.net