Yes, I just have :order in my default_scope. My goal is to have records to be selected with :order for #list and #search, while without :order for list calculations. Could you see and advice any solution for this case (if it's possible at all)?
Did you mean I should remove :order from default_scope (calculations will build unordered subquery, which is OK), then add needed :order clause in #custom_finder_options (#list and #search will use ordered query)? While it may be possible, I still hope there is a way to have :order on model level, rather than controller one… It's seems rather convenient to have models sorted by default, but some people think having :order in default_scope isn't a good idea; instead they propose to have a separate "ordered" scope. This should work for common rails apps, but what about AS? Also, why not just make calculation subquery to explicitly unscope(:order) from any previous scope? Is there any necessity in :order for calculations? MIN(), MAX(), SUM() and AVG() don't depend on order of their arguments… On Mon, 16 Feb 2015 09:15:07 +0100 Sergio Cambra <[email protected]> wrote: > There is no order i calculate_query so I guess you have set order in > beginning_of_chain. You could override custom_finder_options for that, that > method is not used in calculate_query > > El Lunes, 9 de febrero de 2015 19:41:56 'Andrey Korobkov' via ActiveScaffold > : > Ruby on Rails Gem escribió: > > Hello, again > > > > I've already made this work with unscope(:order) in default_scope, > > but order is still used in #calculate_query. > > https://github.com/activescaffold/active_scaffold/blob/master/lib/active_sca > > ffold/finder.rb#L423 > > > > Could you advice me a way to unscope it there? > > Also, could it be unscoped totally in calculations? > > Is ordering really necessary there? > > -- > You received this message because you are subscribed to the Google Groups > "ActiveScaffold : Ruby on Rails Gem" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/activescaffold. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails Gem" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/activescaffold. For more options, visit https://groups.google.com/d/optout.
pgpg3Gr2B__NH.pgp
Description: PGP signature
