Yes sort of? See active scaffold adds sort by id by default unless you tell it to do differently. You told your model to have some default scopes as well. The order in which these are added must be active scaffold scope first, default_scope second, because the id scope shows up higher in priority.
I believe you can turn off the sorting by id, config.columns[:id].sort = false or something like that, it might be config.list.columns[:id].sort = false ~kenny Sent from my Verizon Wireless BlackBerry -----Original Message----- From: "G. Sobrinho" <[email protected]> Date: Wed, 24 Jun 2009 23:39:37 To: <[email protected]> Subject: Re: Order of records with default_scope 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 -~----------~----~----~----~------~----~------~--~---
