Thanks, I understand. Not only me, but others users searched about a scope configuration into AS.
A option for AS to use a specified scope would be nice. Like config.scope = :my_scope. I'm trying to do it here and if I have success, I will submit a pull request. 2009/9/28 Sergio Cambra .:: entreCables S.L. ::. <[email protected]> > > On Viernes, 25 de Septiembre de 2009 16:03:03 Gabriel Sobrinho escribió: > > Em 25-09-2009 10:57, Sergio Cambra .:: entreCables S.L. ::. escreveu: > > > On Viernes, 25 de Septiembre de 2009 15:44:52 G. Sobrinho escribió: > > >> Hi Sergio, > > >> > > >> This generated order clause is without any sorting from the UI, this > > >> should not have the twice columns on generated SQL. > > >> > > >> I think when I sort from the UI this could be: table.ui_column > ASC|DESC, > > >> table.default_scope_column ASC|DESC > > > > > > If you sort from the UI by same column as default_scope, you will get > > > duplicated column. And you can get it with different directions. For > > > example, you set default_scope :order => :name, and in the UI you sort > > > by name descending, you will get "order by table.name DESC, name ASC". > So > > > I don't see the point fixing duplicated columns in initial order clause > > > if you can get it after, even in opposite directions, which makes no > > > sense. > > > > > >> 2009/9/25 Sergio Cambra .:: entreCables S.L. ::.< > [email protected]> > > >> > > >>> On Jueves, 24 de Septiembre de 2009 23:57:53 G. Sobrinho escribió: > > >>>> Hi, > > >>>> > > >>>> Looking at AS I see the AS has support for default_scope now. I have > a > > >>>> model named Page with acts_as_list. So, I setted the default scope: > > >>>> > > >>>> default_scope :order => 'position ASC' > > >>>> > > >>>> > > >>>> But looking at generated SQL by AS I see that: > > >>>> > > >>>> Nested: Page Load (17.6ms) SELECT "pages".* FROM "pages" WHERE > > >>>> (((pages.category_id = '1'))) ORDER BY pages."position" ASC, > position > > >>>> ASC LIMIT 15 OFFSET 0 > > >>>> Direct: Page Load (3.9ms) SELECT "pages".* FROM "pages" ORDER BY > > >>>> pages."position" ASC, position ASC LIMIT 15 OFFSET 0 > > >>> > > >>> We could build an order clause like rails, without including table > > >>> name, or update default_scope with the clause ActiveScaffold builds. > > >>> But when you change > > >>> the sorting in the UI order from default_scope will be added again. > > >>> > > >>>> Another thing is Rails accepts the order option a symbol value and > AS > > >>>> doesn't. This mean: > > >>>> > > >>>> default_scope :order => :position > > >>> > > >>> I have fixed this. > > >>> > > >>> -- > > >>> Sergio Cambra .:: entreCables S.L. ::. > > >>> Mariana Pineda 23, 50.018 Zaragoza > > >>> T) 902 021 404 F) 976 52 98 07 E) [email protected] > > > > AS can use the default scope order clause when haven't a sort by UI > > fallback to primary key if haven't a default order clause. > > > > If user choice a new order clause, using the UI, the default scope order > > clause can be avoided. > > > > What do you think? > > To avoid default scope order, Model.send(:with_exclusive_scope) [block] > must > be used, but then we will skip all default_scope. I don't think it's > desired > to avoid default_scope when you change sorting. > > -- > Sergio Cambra .:: entreCables S.L. ::. > Mariana Pineda 23, 50.018 Zaragoza > T) 902 021 404 F) 976 52 98 07 E) [email protected] > > > > > -- Cordialmente, Gabriel Sobrinho Diretor de desenvolvimento Hite - Comunicação Digital e Mídia Interativa http://www.hite.com.br/ +55 31 8775 8378 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
