{"id":21413208,"url":"https://github.com/github0013/activerecord-includes","last_synced_at":"2025-03-16T18:23:16.951Z","repository":{"id":45481630,"uuid":"337314740","full_name":"github0013/activerecord-includes","owner":"github0013","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-11T18:15:13.000Z","size":68,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T05:15:52.592Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github0013.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-09T06:36:07.000Z","updated_at":"2021-02-10T00:31:42.000Z","dependencies_parsed_at":"2022-07-15T04:00:40.666Z","dependency_job_id":null,"html_url":"https://github.com/github0013/activerecord-includes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github0013%2Factiverecord-includes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github0013%2Factiverecord-includes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github0013%2Factiverecord-includes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github0013%2Factiverecord-includes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github0013","download_url":"https://codeload.github.com/github0013/activerecord-includes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910762,"owners_count":20367544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T18:17:32.675Z","updated_at":"2025-03-16T18:23:16.921Z","avatar_url":"https://github.com/github0013.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Issue with ActiveRecord#includes\n\nChecked with the latest rails versions\n\n- 5.2.4.4\n- 6.1.1\n\n## Models\n\n![](models.png)\n\n## The Problem\n\n- `c_type_xs` is a scoped has_many in A, through Bs (source Cs)\n- `ds` is a distinct has_many in A, through Cs\n\nUnder this condition, if you switch around the orders in includes, you get different results.\n\n### spec/models/a_spec.rb\n\n```rb\nit { expect(A.includes(:c_type_xs, :ds).find(subject.id).c_type_xs.size).to eq 1 }\nit(\"if you switch includes around, you get different results\") do\n  expect(A.includes(:ds, :c_type_xs).find(subject.id).c_type_xs.size).to eq 1\nend\n```\n\n## How to reproduce\n\nJust run the docker, and it will run rspec automatically.\n\n```\n$ git clone \u0026\u0026 cd activerecord-includes\n$ docker-compose run --rm rails-5.2.x\n$ docker-compose run --rm rails-6.1.x\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub0013%2Factiverecord-includes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub0013%2Factiverecord-includes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub0013%2Factiverecord-includes/lists"}