{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/25905","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/25905/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/25905/comments","events_url":"https://api.github.com/repos/rails/rails/issues/25905/events","html_url":"https://github.com/rails/rails/pull/25905","id":166733819,"number":25905,"title":"new method that only cache_if_truthy","user":{"login":"drhenner","id":136110,"avatar_url":"https://avatars.githubusercontent.com/u/136110?v=3","gravatar_id":"","url":"https://api.github.com/users/drhenner","html_url":"https://github.com/drhenner","followers_url":"https://api.github.com/users/drhenner/followers","following_url":"https://api.github.com/users/drhenner/following{/other_user}","gists_url":"https://api.github.com/users/drhenner/gists{/gist_id}","starred_url":"https://api.github.com/users/drhenner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drhenner/subscriptions","organizations_url":"https://api.github.com/users/drhenner/orgs","repos_url":"https://api.github.com/users/drhenner/repos","events_url":"https://api.github.com/users/drhenner/events{/privacy}","received_events_url":"https://api.github.com/users/drhenner/received_events","type":"User","site_admin":false},"labels":[{"id":107194,"url":"https://api.github.com/repos/rails/rails/labels/activesupport","name":"activesupport","color":"FC9300","default":false}],"state":"open","locked":false,"assignee":{"login":"arthurnn","id":833383,"avatar_url":"https://avatars.githubusercontent.com/u/833383?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurnn","html_url":"https://github.com/arthurnn","followers_url":"https://api.github.com/users/arthurnn/followers","following_url":"https://api.github.com/users/arthurnn/following{/other_user}","gists_url":"https://api.github.com/users/arthurnn/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurnn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurnn/subscriptions","organizations_url":"https://api.github.com/users/arthurnn/orgs","repos_url":"https://api.github.com/users/arthurnn/repos","events_url":"https://api.github.com/users/arthurnn/events{/privacy}","received_events_url":"https://api.github.com/users/arthurnn/received_events","type":"User","site_admin":true},"assignees":[{"login":"arthurnn","id":833383,"avatar_url":"https://avatars.githubusercontent.com/u/833383?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurnn","html_url":"https://github.com/arthurnn","followers_url":"https://api.github.com/users/arthurnn/followers","following_url":"https://api.github.com/users/arthurnn/following{/other_user}","gists_url":"https://api.github.com/users/arthurnn/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurnn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurnn/subscriptions","organizations_url":"https://api.github.com/users/arthurnn/orgs","repos_url":"https://api.github.com/users/arthurnn/repos","events_url":"https://api.github.com/users/arthurnn/events{/privacy}","received_events_url":"https://api.github.com/users/arthurnn/received_events","type":"User","site_admin":true}],"milestone":null,"comments":5,"created_at":"2016-07-21T04:12:04Z","updated_at":"2016-11-01T22:28:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/25905","html_url":"https://github.com/rails/rails/pull/25905","diff_url":"https://github.com/rails/rails/pull/25905.diff","patch_url":"https://github.com/rails/rails/pull/25905.patch"},"body":"### Summary\n\nCaches the result of a method if the result is truthy\n\nHence if you do this the result will not be cached:\n  cache_if_truthy(\"User:#{id}:falsy_method\") { nil }\n\nOn the other hand this would be cached.\n  cache_if_truthy(\"User:#{id}:truthy_method\") { 'a string is truthy in ruby' }\n\nBest used for things like `def has_user_visited_page?`\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/257718248","html_url":"https://github.com/rails/rails/pull/25905#issuecomment-257718248","issue_url":"https://api.github.com/repos/rails/rails/issues/25905","id":257718248,"user":{"login":"arthurnn","id":833383,"avatar_url":"https://avatars.githubusercontent.com/u/833383?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurnn","html_url":"https://github.com/arthurnn","followers_url":"https://api.github.com/users/arthurnn/followers","following_url":"https://api.github.com/users/arthurnn/following{/other_user}","gists_url":"https://api.github.com/users/arthurnn/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurnn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurnn/subscriptions","organizations_url":"https://api.github.com/users/arthurnn/orgs","repos_url":"https://api.github.com/users/arthurnn/repos","events_url":"https://api.github.com/users/arthurnn/events{/privacy}","received_events_url":"https://api.github.com/users/arthurnn/received_events","type":"User","site_admin":true},"created_at":"2016-11-01T22:28:25Z","updated_at":"2016-11-01T22:28:25Z","body":"I am not too sure about adding a new API like that to AS cache, I, personally, never had such use case.\r\n@dhh @jeremy have you had to implement this type of thing a lot before?\r\n\r\nMy general rule of thumb is, if this is not something that most of the rails apps will use, and it is easy enough to implement it yourself in your app, i would say this should not go to AS."}}
{"actor":{"display_login":"arthurnn"}}