{"action":"closed","number":213,"pull_request":{"url":"https://api.github.com/repos/flyerhzm/bullet/pulls/213","id":31070396,"html_url":"https://github.com/flyerhzm/bullet/pull/213","diff_url":"https://github.com/flyerhzm/bullet/pull/213.diff","patch_url":"https://github.com/flyerhzm/bullet/pull/213.patch","issue_url":"https://api.github.com/repos/flyerhzm/bullet/issues/213","number":213,"state":"closed","locked":false,"title":"don't execute query when running to_sql","user":{"login":"anthuswilliams","id":521498,"avatar_url":"https://avatars.githubusercontent.com/u/521498?v=3","gravatar_id":"","url":"https://api.github.com/users/anthuswilliams","html_url":"https://github.com/anthuswilliams","followers_url":"https://api.github.com/users/anthuswilliams/followers","following_url":"https://api.github.com/users/anthuswilliams/following{/other_user}","gists_url":"https://api.github.com/users/anthuswilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/anthuswilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthuswilliams/subscriptions","organizations_url":"https://api.github.com/users/anthuswilliams/orgs","repos_url":"https://api.github.com/users/anthuswilliams/repos","events_url":"https://api.github.com/users/anthuswilliams/events{/privacy}","received_events_url":"https://api.github.com/users/anthuswilliams/received_events","type":"User","site_admin":false},"body":"in AR 4.1 and 4.2, to_sql calls find_with_associations\r\nto attach relevant joins so that the produced SQL matches\r\nthe sql actually used when running the query. Bullet's\r\nmonkey-patch of find_with_associations calls the original\r\nwithout a block so it actually passes the query to\r\nthe DB connection and runs it.\r\n\r\nThis commit simply branches the monkey-patch on\r\nblock_given? to make it consistent with AR's\r\ndefinition of the same method. To wit, when\r\nfind_with_associations is called by a block, it\r\nyields a new relation with the correct associations\r\njoined and doesn't pass the query on to the DB.","created_at":"2015-03-12T19:40:12Z","updated_at":"2015-03-13T11:37:43Z","closed_at":"2015-03-13T11:37:43Z","merged_at":"2015-03-13T11:37:43Z","merge_commit_sha":"048a83ff1c9290e326e162f6c57e7a88cc8c4277","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flyerhzm/bullet/pulls/213/commits","review_comments_url":"https://api.github.com/repos/flyerhzm/bullet/pulls/213/comments","review_comment_url":"https://api.github.com/repos/flyerhzm/bullet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flyerhzm/bullet/issues/213/comments","statuses_url":"https://api.github.com/repos/flyerhzm/bullet/statuses/08014d0cfe5ec0ec3ec9001d5b96b5607e909dc0","head":{"label":"anthuswilliams:master","ref":"master","sha":"08014d0cfe5ec0ec3ec9001d5b96b5607e909dc0","user":{"login":"anthuswilliams","id":521498,"avatar_url":"https://avatars.githubusercontent.com/u/521498?v=3","gravatar_id":"","url":"https://api.github.com/users/anthuswilliams","html_url":"https://github.com/anthuswilliams","followers_url":"https://api.github.com/users/anthuswilliams/followers","following_url":"https://api.github.com/users/anthuswilliams/following{/other_user}","gists_url":"https://api.github.com/users/anthuswilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/anthuswilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthuswilliams/subscriptions","organizations_url":"https://api.github.com/users/anthuswilliams/orgs","repos_url":"https://api.github.com/users/anthuswilliams/repos","events_url":"https://api.github.com/users/anthuswilliams/events{/privacy}","received_events_url":"https://api.github.com/users/anthuswilliams/received_events","type":"User","site_admin":false},"repo":{"id":32097462,"name":"bullet","full_name":"anthuswilliams/bullet","owner":{"login":"anthuswilliams","id":521498,"avatar_url":"https://avatars.githubusercontent.com/u/521498?v=3","gravatar_id":"","url":"https://api.github.com/users/anthuswilliams","html_url":"https://github.com/anthuswilliams","followers_url":"https://api.github.com/users/anthuswilliams/followers","following_url":"https://api.github.com/users/anthuswilliams/following{/other_user}","gists_url":"https://api.github.com/users/anthuswilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/anthuswilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthuswilliams/subscriptions","organizations_url":"https://api.github.com/users/anthuswilliams/orgs","repos_url":"https://api.github.com/users/anthuswilliams/repos","events_url":"https://api.github.com/users/anthuswilliams/events{/privacy}","received_events_url":"https://api.github.com/users/anthuswilliams/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anthuswilliams/bullet","description":"help to kill N+1 queries and unused eager loading","fork":true,"url":"https://api.github.com/repos/anthuswilliams/bullet","forks_url":"https://api.github.com/repos/anthuswilliams/bullet/forks","keys_url":"https://api.github.com/repos/anthuswilliams/bullet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anthuswilliams/bullet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anthuswilliams/bullet/teams","hooks_url":"https://api.github.com/repos/anthuswilliams/bullet/hooks","issue_events_url":"https://api.github.com/repos/anthuswilliams/bullet/issues/events{/number}","events_url":"https://api.github.com/repos/anthuswilliams/bullet/events","assignees_url":"https://api.github.com/repos/anthuswilliams/bullet/assignees{/user}","branches_url":"https://api.github.com/repos/anthuswilliams/bullet/branches{/branch}","tags_url":"https://api.github.com/repos/anthuswilliams/bullet/tags","blobs_url":"https://api.github.com/repos/anthuswilliams/bullet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anthuswilliams/bullet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anthuswilliams/bullet/git/refs{/sha}","trees_url":"https://api.github.com/repos/anthuswilliams/bullet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anthuswilliams/bullet/statuses/{sha}","languages_url":"https://api.github.com/repos/anthuswilliams/bullet/languages","stargazers_url":"https://api.github.com/repos/anthuswilliams/bullet/stargazers","contributors_url":"https://api.github.com/repos/anthuswilliams/bullet/contributors","subscribers_url":"https://api.github.com/repos/anthuswilliams/bullet/subscribers","subscription_url":"https://api.github.com/repos/anthuswilliams/bullet/subscription","commits_url":"https://api.github.com/repos/anthuswilliams/bullet/commits{/sha}","git_commits_url":"https://api.github.com/repos/anthuswilliams/bullet/git/commits{/sha}","comments_url":"https://api.github.com/repos/anthuswilliams/bullet/comments{/number}","issue_comment_url":"https://api.github.com/repos/anthuswilliams/bullet/issues/comments{/number}","contents_url":"https://api.github.com/repos/anthuswilliams/bullet/contents/{+path}","compare_url":"https://api.github.com/repos/anthuswilliams/bullet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anthuswilliams/bullet/merges","archive_url":"https://api.github.com/repos/anthuswilliams/bullet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anthuswilliams/bullet/downloads","issues_url":"https://api.github.com/repos/anthuswilliams/bullet/issues{/number}","pulls_url":"https://api.github.com/repos/anthuswilliams/bullet/pulls{/number}","milestones_url":"https://api.github.com/repos/anthuswilliams/bullet/milestones{/number}","notifications_url":"https://api.github.com/repos/anthuswilliams/bullet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anthuswilliams/bullet/labels{/name}","releases_url":"https://api.github.com/repos/anthuswilliams/bullet/releases{/id}","created_at":"2015-03-12T19:26:08Z","updated_at":"2015-03-12T19:38:55Z","pushed_at":"2015-03-12T19:38:54Z","git_url":"git://github.com/anthuswilliams/bullet.git","ssh_url":"git@github.com:anthuswilliams/bullet.git","clone_url":"https://github.com/anthuswilliams/bullet.git","svn_url":"https://github.com/anthuswilliams/bullet","homepage":"","size":1838,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"flyerhzm:master","ref":"master","sha":"f762bd61ff597002b3f0cbad3d6cae12a0acaa44","user":{"login":"flyerhzm","id":66836,"avatar_url":"https://avatars.githubusercontent.com/u/66836?v=3","gravatar_id":"","url":"https://api.github.com/users/flyerhzm","html_url":"https://github.com/flyerhzm","followers_url":"https://api.github.com/users/flyerhzm/followers","following_url":"https://api.github.com/users/flyerhzm/following{/other_user}","gists_url":"https://api.github.com/users/flyerhzm/gists{/gist_id}","starred_url":"https://api.github.com/users/flyerhzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyerhzm/subscriptions","organizations_url":"https://api.github.com/users/flyerhzm/orgs","repos_url":"https://api.github.com/users/flyerhzm/repos","events_url":"https://api.github.com/users/flyerhzm/events{/privacy}","received_events_url":"https://api.github.com/users/flyerhzm/received_events","type":"User","site_admin":false},"repo":{"id":277089,"name":"bullet","full_name":"flyerhzm/bullet","owner":{"login":"flyerhzm","id":66836,"avatar_url":"https://avatars.githubusercontent.com/u/66836?v=3","gravatar_id":"","url":"https://api.github.com/users/flyerhzm","html_url":"https://github.com/flyerhzm","followers_url":"https://api.github.com/users/flyerhzm/followers","following_url":"https://api.github.com/users/flyerhzm/following{/other_user}","gists_url":"https://api.github.com/users/flyerhzm/gists{/gist_id}","starred_url":"https://api.github.com/users/flyerhzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyerhzm/subscriptions","organizations_url":"https://api.github.com/users/flyerhzm/orgs","repos_url":"https://api.github.com/users/flyerhzm/repos","events_url":"https://api.github.com/users/flyerhzm/events{/privacy}","received_events_url":"https://api.github.com/users/flyerhzm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flyerhzm/bullet","description":"help to kill N+1 queries and unused eager loading","fork":false,"url":"https://api.github.com/repos/flyerhzm/bullet","forks_url":"https://api.github.com/repos/flyerhzm/bullet/forks","keys_url":"https://api.github.com/repos/flyerhzm/bullet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flyerhzm/bullet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flyerhzm/bullet/teams","hooks_url":"https://api.github.com/repos/flyerhzm/bullet/hooks","issue_events_url":"https://api.github.com/repos/flyerhzm/bullet/issues/events{/number}","events_url":"https://api.github.com/repos/flyerhzm/bullet/events","assignees_url":"https://api.github.com/repos/flyerhzm/bullet/assignees{/user}","branches_url":"https://api.github.com/repos/flyerhzm/bullet/branches{/branch}","tags_url":"https://api.github.com/repos/flyerhzm/bullet/tags","blobs_url":"https://api.github.com/repos/flyerhzm/bullet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flyerhzm/bullet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flyerhzm/bullet/git/refs{/sha}","trees_url":"https://api.github.com/repos/flyerhzm/bullet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flyerhzm/bullet/statuses/{sha}","languages_url":"https://api.github.com/repos/flyerhzm/bullet/languages","stargazers_url":"https://api.github.com/repos/flyerhzm/bullet/stargazers","contributors_url":"https://api.github.com/repos/flyerhzm/bullet/contributors","subscribers_url":"https://api.github.com/repos/flyerhzm/bullet/subscribers","subscription_url":"https://api.github.com/repos/flyerhzm/bullet/subscription","commits_url":"https://api.github.com/repos/flyerhzm/bullet/commits{/sha}","git_commits_url":"https://api.github.com/repos/flyerhzm/bullet/git/commits{/sha}","comments_url":"https://api.github.com/repos/flyerhzm/bullet/comments{/number}","issue_comment_url":"https://api.github.com/repos/flyerhzm/bullet/issues/comments{/number}","contents_url":"https://api.github.com/repos/flyerhzm/bullet/contents/{+path}","compare_url":"https://api.github.com/repos/flyerhzm/bullet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flyerhzm/bullet/merges","archive_url":"https://api.github.com/repos/flyerhzm/bullet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flyerhzm/bullet/downloads","issues_url":"https://api.github.com/repos/flyerhzm/bullet/issues{/number}","pulls_url":"https://api.github.com/repos/flyerhzm/bullet/pulls{/number}","milestones_url":"https://api.github.com/repos/flyerhzm/bullet/milestones{/number}","notifications_url":"https://api.github.com/repos/flyerhzm/bullet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flyerhzm/bullet/labels{/name}","releases_url":"https://api.github.com/repos/flyerhzm/bullet/releases{/id}","created_at":"2009-08-13T15:47:31Z","updated_at":"2015-03-13T10:08:55Z","pushed_at":"2015-03-13T11:37:43Z","git_url":"git://github.com/flyerhzm/bullet.git","ssh_url":"git@github.com:flyerhzm/bullet.git","clone_url":"https://github.com/flyerhzm/bullet.git","svn_url":"https://github.com/flyerhzm/bullet","homepage":"","size":1838,"stargazers_count":3076,"watchers_count":3076,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":139,"mirror_url":null,"open_issues_count":15,"forks":139,"open_issues":15,"watchers":3076,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flyerhzm/bullet/pulls/213"},"html":{"href":"https://github.com/flyerhzm/bullet/pull/213"},"issue":{"href":"https://api.github.com/repos/flyerhzm/bullet/issues/213"},"comments":{"href":"https://api.github.com/repos/flyerhzm/bullet/issues/213/comments"},"review_comments":{"href":"https://api.github.com/repos/flyerhzm/bullet/pulls/213/comments"},"review_comment":{"href":"https://api.github.com/repos/flyerhzm/bullet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flyerhzm/bullet/pulls/213/commits"},"statuses":{"href":"https://api.github.com/repos/flyerhzm/bullet/statuses/08014d0cfe5ec0ec3ec9001d5b96b5607e909dc0"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"flyerhzm","id":66836,"avatar_url":"https://avatars.githubusercontent.com/u/66836?v=3","gravatar_id":"","url":"https://api.github.com/users/flyerhzm","html_url":"https://github.com/flyerhzm","followers_url":"https://api.github.com/users/flyerhzm/followers","following_url":"https://api.github.com/users/flyerhzm/following{/other_user}","gists_url":"https://api.github.com/users/flyerhzm/gists{/gist_id}","starred_url":"https://api.github.com/users/flyerhzm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flyerhzm/subscriptions","organizations_url":"https://api.github.com/users/flyerhzm/orgs","repos_url":"https://api.github.com/users/flyerhzm/repos","events_url":"https://api.github.com/users/flyerhzm/events{/privacy}","received_events_url":"https://api.github.com/users/flyerhzm/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"commits":1,"additions":2,"deletions":0,"changed_files":2}}