Yes, the id ASC are added because ActiveScaffold tryed to sort by it. But by default, in theory, the Active Scaffold can't sort the records by any fields except I explicited it. Not?
2009/6/24 <[email protected]> > I belive active scaffold tries to order by I'd by default so it is adding > it. > > I would use the config sort that active scaffold provides for you, look at > the list config wiki page for examples > > Sent from my Verizon Wireless BlackBerry > > ------------------------------ > *From*: "G. Sobrinho" > *Date*: Wed, 24 Jun 2009 19:07:39 -0300 > *To*: activescaffold<[email protected]> > *Subject*: Order of records with default_scope > Hello, > > I'm using default_scope on some models to sort the records but the AS have > a issue with that. > > For example, i have a model named Page: > > class Page < ActiveRecord::Base > default_scope :joins => :category, :order => 'categories.order ASC, > pages.order ASC' > end > > > When I access the list, the SQL generated is (order part): "ORDER BY > pages.id ASC, categories.order ASC, pages.order ASC" > But I don't setted the AS to sort by id. Well, this doesn't work. > > It's a bug? > > > Thank you > > -- > Regards, > > Gabriel Sobrinho > E-mail: [email protected] > Phone: +55 31 8775 8378 > > Don't print this e-mail. The nature is thankful and your money also. > > > > > > -- Regards, Gabriel Sobrinho E-mail: [email protected] Phone: +55 31 8775 8378 Don't print this e-mail. The nature is thankful and your money also. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
