{"action":"created","issue":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/2862","repository_url":"https://api.github.com/repos/bbatsov/rubocop","labels_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2862/labels{/name}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2862/comments","events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2862/events","html_url":"https://github.com/bbatsov/rubocop/pull/2862","id":134473957,"number":2862,"title":"Make cops with Rails compatibility issue dependant on Rails cops being disabled","user":{"login":"rrosenblum","id":1528852,"avatar_url":"https://avatars.githubusercontent.com/u/1528852?v=3","gravatar_id":"","url":"https://api.github.com/users/rrosenblum","html_url":"https://github.com/rrosenblum","followers_url":"https://api.github.com/users/rrosenblum/followers","following_url":"https://api.github.com/users/rrosenblum/following{/other_user}","gists_url":"https://api.github.com/users/rrosenblum/gists{/gist_id}","starred_url":"https://api.github.com/users/rrosenblum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrosenblum/subscriptions","organizations_url":"https://api.github.com/users/rrosenblum/orgs","repos_url":"https://api.github.com/users/rrosenblum/repos","events_url":"https://api.github.com/users/rrosenblum/events{/privacy}","received_events_url":"https://api.github.com/users/rrosenblum/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-02-18T03:46:23Z","updated_at":"2016-03-30T01:09:49Z","closed_at":"2016-03-22T22:09:25Z","pull_request":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/2862","html_url":"https://github.com/bbatsov/rubocop/pull/2862","diff_url":"https://github.com/bbatsov/rubocop/pull/2862.diff","patch_url":"https://github.com/bbatsov/rubocop/pull/2862.patch"},"body":"It has been a while since this has come up, but it is still a known issue. Since we cannot determine if the method comes from Ruby or Rails, the next best thing is to determine if Rails is going to be in used and not run these cops if it is. Short of scanning the Gemfile for a rails entry, this seemed like the easiest and most self contained approach. If anyone has an alternative idea, I am open to suggestions."},"comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments/203178562","html_url":"https://github.com/bbatsov/rubocop/pull/2862#issuecomment-203178562","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/2862","id":203178562,"user":{"login":"rrosenblum","id":1528852,"avatar_url":"https://avatars.githubusercontent.com/u/1528852?v=3","gravatar_id":"","url":"https://api.github.com/users/rrosenblum","html_url":"https://github.com/rrosenblum","followers_url":"https://api.github.com/users/rrosenblum/followers","following_url":"https://api.github.com/users/rrosenblum/following{/other_user}","gists_url":"https://api.github.com/users/rrosenblum/gists{/gist_id}","starred_url":"https://api.github.com/users/rrosenblum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrosenblum/subscriptions","organizations_url":"https://api.github.com/users/rrosenblum/orgs","repos_url":"https://api.github.com/users/rrosenblum/repos","events_url":"https://api.github.com/users/rrosenblum/events{/privacy}","received_events_url":"https://api.github.com/users/rrosenblum/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T01:09:49Z","updated_at":"2016-03-30T01:09:49Z","body":"I remembered the issue. ActiveRecord partially supports `find` with a block. \r\n\r\n`User.where(username: 'username').select { |u| u.active }.first` can be converted to `User.where(username: 'username').find { |u| u.active }`. Unfortunately, `User.select { |u| u.username == 'username' }.first` cannot be converted to `User.find { |u| u.username == 'username' }`. This results in `ActiveRecord::RecordNotFound: Couldn't find User without an ID`.\r\n"}}