Hi all,

here's a problem of mine. Member has many MemberIntegration, 
MemberIntegration has many MemberIntegrationField

I need to load paginated members and order id by a 
MemberIntegrationField#value.

In the database I have 100 members.

ActiveRecord:

```
Member.includes(member_integrations: 
[:member_integration_fields]).order('member_integration_fields.id').to_a.count
```

uses `LEFT OUTER JOIN` and it returns 100 members.

Important thing to know is when I run the plain SQL in the pgAdmin, it 
returns `6XX` members, depends on the associations. It gives me an idea 
that ActiveRecord somehow deletes those duplicates. Not sure how yet.

What would be the sequel alternative for that?

I've tried `eager` but that does not allow me order by child attribute, as 
children associations will be loaded in another query.

I've tried `eager_graph` but I ends up with `6XX` members.

Any idea how to deal with such a query? Thank you

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/b669cf19-88e4-4189-af55-bbaed9b3b30bn%40googlegroups.com.

Reply via email to