{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/34624721","id":34624721,"diff_hunk":"@@ -1,12 +1,24 @@\n+require \"active_support/deprecation\"\n+\n module ActiveRecord\n   module Associations\n     class SingularAssociation < Association #:nodoc:\n       # Implements the reader method, e.g. foo.bar for Foo.has_one :bar\n-      def reader(force_reload = false)\n-        if force_reload && klass\n-          klass.uncached { reload }\n+      def reader(force_reload = nil, reload: false)\n+        unless force_reload.nil?\n+          ActiveSupport::Deprecation.warn(<<-MSG.squish)\n+            Passing only `true` to force a collection to reload is now","path":"activerecord/lib/active_record/associations/singular_association.rb","position":13,"original_position":13,"commit_id":"ca0bd4263c84eb7c24793d8f92f107675d6dcf94","original_commit_id":"ca0bd4263c84eb7c24793d8f92f107675d6dcf94","user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"body":"This one isn't a collection","created_at":"2015-07-14T21:54:08Z","updated_at":"2015-07-14T21:54:08Z","html_url":"https://github.com/rails/rails/pull/20883#discussion_r34624721","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/20883","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/34624721"},"html":{"href":"https://github.com/rails/rails/pull/20883#discussion_r34624721"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/20883"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/20883","id":39966646,"html_url":"https://github.com/rails/rails/pull/20883","diff_url":"https://github.com/rails/rails/pull/20883.diff","patch_url":"https://github.com/rails/rails/pull/20883.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/20883","number":20883,"state":"open","locked":false,"title":"Change the way to force reload association from passing `true` to `reload: true`","user":{"login":"sikachu","id":4912,"avatar_url":"https://avatars.githubusercontent.com/u/4912?v=3","gravatar_id":"","url":"https://api.github.com/users/sikachu","html_url":"https://github.com/sikachu","followers_url":"https://api.github.com/users/sikachu/followers","following_url":"https://api.github.com/users/sikachu/following{/other_user}","gists_url":"https://api.github.com/users/sikachu/gists{/gist_id}","starred_url":"https://api.github.com/users/sikachu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sikachu/subscriptions","organizations_url":"https://api.github.com/users/sikachu/orgs","repos_url":"https://api.github.com/users/sikachu/repos","events_url":"https://api.github.com/users/sikachu/events{/privacy}","received_events_url":"https://api.github.com/users/sikachu/received_events","type":"User","site_admin":false},"body":"This makes the method call clearer as it defines the intention that user want to force reload the association.\r\n\r\nExample:\r\n\r\n```ruby\r\n@user.posts(reload: true)\r\n@user.profile(reload: true)\r\n```\r\n\r\nPassing only `true` to the method is now considered deprecated, and user will get a deprecation warning message. The old usage will be completely removed in Rails 5.1.","created_at":"2015-07-14T21:45:51Z","updated_at":"2015-07-14T21:54:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b7f5a1ec46c5d364bc095daf256c651f9359338","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/20883/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/20883/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/20883/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/ca0bd4263c84eb7c24793d8f92f107675d6dcf94","head":{"label":"sikachu:association-explicit-reload","ref":"association-explicit-reload","sha":"ca0bd4263c84eb7c24793d8f92f107675d6dcf94","user":{"login":"sikachu","id":4912,"avatar_url":"https://avatars.githubusercontent.com/u/4912?v=3","gravatar_id":"","url":"https://api.github.com/users/sikachu","html_url":"https://github.com/sikachu","followers_url":"https://api.github.com/users/sikachu/followers","following_url":"https://api.github.com/users/sikachu/following{/other_user}","gists_url":"https://api.github.com/users/sikachu/gists{/gist_id}","starred_url":"https://api.github.com/users/sikachu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sikachu/subscriptions","organizations_url":"https://api.github.com/users/sikachu/orgs","repos_url":"https://api.github.com/users/sikachu/repos","events_url":"https://api.github.com/users/sikachu/events{/privacy}","received_events_url":"https://api.github.com/users/sikachu/received_events","type":"User","site_admin":false},"repo":{"id":1538453,"name":"rails","full_name":"sikachu/rails","owner":{"login":"sikachu","id":4912,"avatar_url":"https://avatars.githubusercontent.com/u/4912?v=3","gravatar_id":"","url":"https://api.github.com/users/sikachu","html_url":"https://github.com/sikachu","followers_url":"https://api.github.com/users/sikachu/followers","following_url":"https://api.github.com/users/sikachu/following{/other_user}","gists_url":"https://api.github.com/users/sikachu/gists{/gist_id}","starred_url":"https://api.github.com/users/sikachu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sikachu/subscriptions","organizations_url":"https://api.github.com/users/sikachu/orgs","repos_url":"https://api.github.com/users/sikachu/repos","events_url":"https://api.github.com/users/sikachu/events{/privacy}","received_events_url":"https://api.github.com/users/sikachu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sikachu/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/sikachu/rails","forks_url":"https://api.github.com/repos/sikachu/rails/forks","keys_url":"https://api.github.com/repos/sikachu/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sikachu/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sikachu/rails/teams","hooks_url":"https://api.github.com/repos/sikachu/rails/hooks","issue_events_url":"https://api.github.com/repos/sikachu/rails/issues/events{/number}","events_url":"https://api.github.com/repos/sikachu/rails/events","assignees_url":"https://api.github.com/repos/sikachu/rails/assignees{/user}","branches_url":"https://api.github.com/repos/sikachu/rails/branches{/branch}","tags_url":"https://api.github.com/repos/sikachu/rails/tags","blobs_url":"https://api.github.com/repos/sikachu/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sikachu/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sikachu/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/sikachu/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sikachu/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/sikachu/rails/languages","stargazers_url":"https://api.github.com/repos/sikachu/rails/stargazers","contributors_url":"https://api.github.com/repos/sikachu/rails/contributors","subscribers_url":"https://api.github.com/repos/sikachu/rails/subscribers","subscription_url":"https://api.github.com/repos/sikachu/rails/subscription","commits_url":"https://api.github.com/repos/sikachu/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/sikachu/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/sikachu/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/sikachu/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/sikachu/rails/contents/{+path}","compare_url":"https://api.github.com/repos/sikachu/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sikachu/rails/merges","archive_url":"https://api.github.com/repos/sikachu/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sikachu/rails/downloads","issues_url":"https://api.github.com/repos/sikachu/rails/issues{/number}","pulls_url":"https://api.github.com/repos/sikachu/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/sikachu/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/sikachu/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sikachu/rails/labels{/name}","releases_url":"https://api.github.com/repos/sikachu/rails/releases{/id}","created_at":"2011-03-28T20:19:54Z","updated_at":"2015-03-10T00:47:32Z","pushed_at":"2015-07-14T21:48:12Z","git_url":"git://github.com/sikachu/rails.git","ssh_url":"git@github.com:sikachu/rails.git","clone_url":"https://github.com/sikachu/rails.git","svn_url":"https://github.com/sikachu/rails","homepage":"http://rubyonrails.org","size":133037,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"4d4d764ab688af4a0d213ab2d0dc7f9b811ab451","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","created_at":"2008-04-11T02:19:47Z","updated_at":"2015-07-14T21:50:11Z","pushed_at":"2015-07-14T21:48:26Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":428500,"stargazers_count":26903,"watchers_count":26903,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10739,"mirror_url":null,"open_issues_count":856,"forks":10739,"open_issues":856,"watchers":26903,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/20883"},"html":{"href":"https://github.com/rails/rails/pull/20883"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/20883"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/20883/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/20883/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/20883/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/ca0bd4263c84eb7c24793d8f92f107675d6dcf94"}}}}