For instance, if I wanted to order by "created_at", then order that again by "last_contacted", how would I do so? I tried something like this, but unfortunately didn''t work: :order => ''created_date DESC, last_contacted ASC'' Any ideas? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8/24/07, Bob Sanders <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > For instance, if I wanted to order by "created_at", then order that > again by "last_contacted", how would I do so? > > I tried something like this, but unfortunately didn''t work: :order => > ''created_date DESC, last_contacted ASC'' > > Any ideas? > -- > Posted via http://www.ruby-forum.com/. > > > >erm, it didn''t? Did you get an error or did it just not return the records in the order you expected? Because that looks like it should work fine... Pat --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m assuming that you meant to write: :order => "created_at DESC, last_contacted ASC" Instead of :order => "created_date DESC, last_contacted ASC" But, other than that it looks fine. You could even drop the ASC if you want, since that''s the default in SQL. :order => "created_at DESC, last_contacted" On Aug 24, 7:31 pm, "Pat Maddox" <perg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 8/24/07, Bob Sanders <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > > For instance, if I wanted to order by "created_at", then order that > > again by "last_contacted", how would I do so? > > > I tried something like this, but unfortunately didn''t work: :order => > > ''created_date DESC, last_contacted ASC'' > > > Any ideas? > > -- > > Posted viahttp://www.ruby-forum.com/. > > erm, it didn''t? Did you get an error or did it just not return the > records in the order you expected? Because that looks like it should > work fine... > > Pat--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---