Hi,

ActiveRecord is adding default_scope order clause in any case...
except the order condition defined in your specific find call exactly
matches the one defined in default_scope.

AS uses the following order syntax:
<table_name>.<quoted_attribute_name>

That s the reason why you see this strange order column in your sql
statement (AS generated order does not exactly match the one you
defined with default_scope).

Currently, the only way to avoid this is to define default_scope like
active_record does:
in your example:
default_scope :order => "pages.#{connection.quote_column_name
('position')} ASC"

--
Volker


On 24 Sep., 23:57, "G. Sobrinho" <[email protected]> wrote:
> 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
>
> Another thing is Rails accepts the order option a symbol value and AS
> doesn't. This mean:
>
> default_scope :order => :position
>
> --
> Cordialmente,
>
> Gabriel Sobrinho
> Diretor de desenvolvimento
>
> Hite - Comunicação Digital e Mídia Interativahttp://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to