Hi,

I've been wondering why calling `association_join' and
`select' in different order would matter? For example,
this does work as expected:

    User.association_join(:expertises).
      select{[users.*, count(users__id)]}.
      group_by(:users__id).sql

# => SELECT "users".*, count("users"."id") FROM "users" INNER JOIN
"expertises" ON ("expertises"."user_id" = "users"."id") GROUP BY
"users"."id"

But if I change the order of association_join and select,
it won't work:

    User.select{[users.*, count(users__id)]}.
      association_join(:expertises).
      group_by(:users__id).sql

Here's the error:

# => Sequel::Error: can't figure out alias to use for graphing for
#<Sequel::SQL::ColumnAll @table=>#<Sequel::SQL::Identifier
@value=>:users>>

If I remove the count in `select', both would work,
but oddly it would immediately make a query:

    User.select{users.*}.
      association_join(:expertises).
      group_by(:users__id).sql

# => SELECT "users".* FROM "users" LIMIT 1

Not that I am only calling `sql', not expecting it
would make a query at all.

Thanks for any hints.

Cheers,

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to