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 Margolis blog.mattmargolis.net
On Jul 1, 2006, at 7:33 PM, Matthew Margolis wrote:> 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 Margolis > blog.mattmargolis.netThere is a recent patch to fix this here: http://dev.rubyonrails.org/ticket/3438 -Ezra
Ezra Zygmuntowicz wrote:> > On Jul 1, 2006, at 7:33 PM, Matthew Margolis wrote: > >> 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 Margolis >> blog.mattmargolis.net > > > There is a recent patch to fix this here: > > http://dev.rubyonrails.org/ticket/3438 > > -Ezra > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsGreat. Thank you. Matthew Margolis blog.mattmargolis.net