These are chat archives for rails-sqlserver/activerecord-sqlserver-adapter

10th
Jul 2018
Jeffrey M Castro
@jeffreycastro
Jul 10 2018 03:44

@KDGundermann I think the reason is the "includes" vs "left_joins".
Device.left_joins(:health_records).order('health_records.error_number desc').page(1).limit(10).count returns 10

Device.includes(:health_records).order('health_records.error_number desc').page(1).limit(10).count returns 3

the only difference is includes and left_joins in the queries above. can you explain to me why?
Jeffrey M Castro
@jeffreycastro
Jul 10 2018 05:06
i think i got it now.
used left_joins and subqueries + select to be able to order properly.
Klaus
@KDGundermann
Jul 10 2018 06:57
;-)