{"action":"created","issue":{"url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys/issues/433","repository_url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys","labels_url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys/issues/433/labels{/name}","comments_url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys/issues/433/comments","events_url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys/issues/433/events","html_url":"https://github.com/composite-primary-keys/composite_primary_keys/pull/433","id":309224430,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc3OTMyMjE2","number":433,"title":"Set inversion when using preload Rails 5.1.x","user":{"login":"letrungkien","id":8326788,"node_id":"MDQ6VXNlcjgzMjY3ODg=","avatar_url":"https://avatars2.githubusercontent.com/u/8326788?v=4","gravatar_id":"","url":"https://api.github.com/users/letrungkien","html_url":"https://github.com/letrungkien","followers_url":"https://api.github.com/users/letrungkien/followers","following_url":"https://api.github.com/users/letrungkien/following{/other_user}","gists_url":"https://api.github.com/users/letrungkien/gists{/gist_id}","starred_url":"https://api.github.com/users/letrungkien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/letrungkien/subscriptions","organizations_url":"https://api.github.com/users/letrungkien/orgs","repos_url":"https://api.github.com/users/letrungkien/repos","events_url":"https://api.github.com/users/letrungkien/events{/privacy}","received_events_url":"https://api.github.com/users/letrungkien/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-28T05:18:53Z","updated_at":"2018-07-02T08:31:54Z","closed_at":"2018-06-07T06:37:00Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys/pulls/433","html_url":"https://github.com/composite-primary-keys/composite_primary_keys/pull/433","diff_url":"https://github.com/composite-primary-keys/composite_primary_keys/pull/433.diff","patch_url":"https://github.com/composite-primary-keys/composite_primary_keys/pull/433.patch"},"body":"Thanks for making this awesome gem.\r\nWe had N+1 problem when upgrading to Rails 5.1.5 using composite-primary-keys v10.0.3\r\n\r\nAssuming we have `Country` and `City` model and `Country` has_many `City`.\r\n```ruby\r\ncountries = Country.preload(:cities)\r\ncity = countries.first.cities.first\r\ncity.association(:country).loaded? #=> false\r\ncity.country # will trigger call to DB\r\n```\r\n\r\nNot sure why inversion is not set. The difference lies in these 2 lines: https://github.com/rails/rails/blob/v5.1.5/activerecord/lib/active_record/associations/preloader/association.rb#L63-L64\r\n\r\nI noticed that tests failed due to the recent update in `mysql2` from `0.4.10` to `0.5.0` and made a separate PR to address the issue: #434 \r\n"},"comment":{"url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys/issues/comments/401711373","html_url":"https://github.com/composite-primary-keys/composite_primary_keys/pull/433#issuecomment-401711373","issue_url":"https://api.github.com/repos/composite-primary-keys/composite_primary_keys/issues/433","id":401711373,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTcxMTM3Mw==","user":{"login":"letrungkien","id":8326788,"node_id":"MDQ6VXNlcjgzMjY3ODg=","avatar_url":"https://avatars2.githubusercontent.com/u/8326788?v=4","gravatar_id":"","url":"https://api.github.com/users/letrungkien","html_url":"https://github.com/letrungkien","followers_url":"https://api.github.com/users/letrungkien/followers","following_url":"https://api.github.com/users/letrungkien/following{/other_user}","gists_url":"https://api.github.com/users/letrungkien/gists{/gist_id}","starred_url":"https://api.github.com/users/letrungkien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/letrungkien/subscriptions","organizations_url":"https://api.github.com/users/letrungkien/orgs","repos_url":"https://api.github.com/users/letrungkien/repos","events_url":"https://api.github.com/users/letrungkien/events{/privacy}","received_events_url":"https://api.github.com/users/letrungkien/received_events","type":"User","site_admin":false},"created_at":"2018-07-02T08:31:54Z","updated_at":"2018-07-02T08:31:54Z","author_association":"NONE","body":"@cfis sorry to trouble you.\r\nI checked that v11.x already handled the issue here:\r\nhttps://github.com/composite-primary-keys/composite_primary_keys/blob/v11.0.3/lib/composite_primary_keys/associations/preloader/association.rb#L106-L107"}}
{"actor":{"display_login":"letrungkien"}}