It would be nice to know what error gets thrown. I suspect it has
something to do with using :select in a find where you also
use :include, but I may be wrong. As far as I know, :select is ignored
when you used :include.
Another potential error is that you’re joining the users table twice:
once on the :include (a left outer join), and once with the :joins (an
inner join). The generated SQL would not contain aliases for the
joined table, so it is specifying users twice. Is it your DBMS
throwing the error?
From the look of your :select, it seems like what you want back is
User objects, not Greeter objects. If so, why are you querying using
“Greeter.find”, instead of “User.find”?
This could probably be what you’re looking for:
User.all(:joins => :greeter, :order => ‘users.nickname’) #get all
users who also are greeters.
Greeter.all(:include => :users, :order => ‘users.nickname’) #get all
greeters, and eager load the users.
What is it? No idea!