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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Jul 29, 2010 at 11:15 AM, Mark Horrocks <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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 destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald wrote:> Car.order("make").all > -- > Greg Donald > destiney.com | gregdonald.comThank you! :) It seems odd considering that Car.where(blah blah).order(''make'') works. Mark Horrocks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mark Horrocks wrote:> Greg Donald wrote: >> Car.order("make").all >> -- >> Greg Donald >> destiney.com | gregdonald.com > > Thank you! :) 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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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.allAh yes, that would take advantage of the lazy loading I think. And the syntax makes more sense. Thanks. Mark -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.