{"action":"closed","number":212,"pull_request":{"url":"https://api.github.com/repos/radar/paranoia/pulls/212","id":29276139,"html_url":"https://github.com/radar/paranoia/pull/212","diff_url":"https://github.com/radar/paranoia/pull/212.diff","patch_url":"https://github.com/radar/paranoia/pull/212.patch","issue_url":"https://api.github.com/repos/radar/paranoia/issues/212","number":212,"state":"closed","locked":false,"title":"Remove table_name from where methods","user":{"login":"stgeneral","id":1227892,"avatar_url":"https://avatars.githubusercontent.com/u/1227892?v=3","gravatar_id":"","url":"https://api.github.com/users/stgeneral","html_url":"https://github.com/stgeneral","followers_url":"https://api.github.com/users/stgeneral/followers","following_url":"https://api.github.com/users/stgeneral/following{/other_user}","gists_url":"https://api.github.com/users/stgeneral/gists{/gist_id}","starred_url":"https://api.github.com/users/stgeneral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stgeneral/subscriptions","organizations_url":"https://api.github.com/users/stgeneral/orgs","repos_url":"https://api.github.com/users/stgeneral/repos","events_url":"https://api.github.com/users/stgeneral/events{/privacy}","received_events_url":"https://api.github.com/users/stgeneral/received_events","type":"User","site_admin":false},"body":"There is no need to specify `table_name` because Rails does it automatically.\r\n\r\nMore over, explicit specifying `table_name` failed for me in such case.\r\n\r\n```ruby\r\nclass FirstModel\r\n  has_many :second_models\r\n  has_many :third_models, through: :second_models\r\nend\r\n\r\nclass SecondModel\r\n  belongs_to :first_model\r\n  has_many :third_models\r\nend\r\n\r\nclass ThirdModel\r\n  belongs_to :first_model\r\nend\r\n\r\nFirstModel.first.third_models.joins(:second_models).to_sql\r\n```\r\n```sql\r\nSELECT `third_models`.*\r\n\tFROM `third_models`\r\n\t\tINNER JOIN `second_models` `secod_models_third_models`\r\n\t\t\tON `secod_models_third_models`.`id` = `third_models`.`second_model_id`\r\n\t\t\t\tAND `second_models`.`deleted_at` IS NULL\r\n\t\t\t\tAND `secod_models_third_models`.`id` = 1\r\n\t\tINNER JOIN `second_models` ON `third_models`.`second_model_id` = `second_models`.`id`\r\n\tWHERE `third_models`.`deleted_at` IS NULL\r\n\t\tAND `second_models`.`deleted_at` IS NULL\r\n\t\tAND `second_models`.`id` = 1\r\n\t\tAND `second_models`.`first_model_id` = 1\r\n```\r\n\r\n```\r\nUnknown column 'second_models.deleted_at' in 'on clause'\r\n```\r\n\r\nI know that `joins(:second_models)` is a bit redundant but it is done automatically by universal scoping in my code. Still, it should not fail in any case.\r\n\r\nThere is another issue - double joining - but it is another problem.","created_at":"2015-02-13T16:09:38Z","updated_at":"2015-04-09T00:18:16Z","closed_at":"2015-04-09T00:18:16Z","merged_at":"2015-04-09T00:18:16Z","merge_commit_sha":"56bb73279d38d113ac8e9ac1d29a1f7c7ce0a0a7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/radar/paranoia/pulls/212/commits","review_comments_url":"https://api.github.com/repos/radar/paranoia/pulls/212/comments","review_comment_url":"https://api.github.com/repos/radar/paranoia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/radar/paranoia/issues/212/comments","statuses_url":"https://api.github.com/repos/radar/paranoia/statuses/066ab79082ab0a20aefc362b1a27a8836ab2e220","head":{"label":"stgeneral:remove-table-name-from-where","ref":"remove-table-name-from-where","sha":"066ab79082ab0a20aefc362b1a27a8836ab2e220","user":{"login":"stgeneral","id":1227892,"avatar_url":"https://avatars.githubusercontent.com/u/1227892?v=3","gravatar_id":"","url":"https://api.github.com/users/stgeneral","html_url":"https://github.com/stgeneral","followers_url":"https://api.github.com/users/stgeneral/followers","following_url":"https://api.github.com/users/stgeneral/following{/other_user}","gists_url":"https://api.github.com/users/stgeneral/gists{/gist_id}","starred_url":"https://api.github.com/users/stgeneral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stgeneral/subscriptions","organizations_url":"https://api.github.com/users/stgeneral/orgs","repos_url":"https://api.github.com/users/stgeneral/repos","events_url":"https://api.github.com/users/stgeneral/events{/privacy}","received_events_url":"https://api.github.com/users/stgeneral/received_events","type":"User","site_admin":false},"repo":{"id":30762787,"name":"paranoia","full_name":"stgeneral/paranoia","owner":{"login":"stgeneral","id":1227892,"avatar_url":"https://avatars.githubusercontent.com/u/1227892?v=3","gravatar_id":"","url":"https://api.github.com/users/stgeneral","html_url":"https://github.com/stgeneral","followers_url":"https://api.github.com/users/stgeneral/followers","following_url":"https://api.github.com/users/stgeneral/following{/other_user}","gists_url":"https://api.github.com/users/stgeneral/gists{/gist_id}","starred_url":"https://api.github.com/users/stgeneral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stgeneral/subscriptions","organizations_url":"https://api.github.com/users/stgeneral/orgs","repos_url":"https://api.github.com/users/stgeneral/repos","events_url":"https://api.github.com/users/stgeneral/events{/privacy}","received_events_url":"https://api.github.com/users/stgeneral/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stgeneral/paranoia","description":"acts_as_paranoid for Rails 3 & 4","fork":true,"url":"https://api.github.com/repos/stgeneral/paranoia","forks_url":"https://api.github.com/repos/stgeneral/paranoia/forks","keys_url":"https://api.github.com/repos/stgeneral/paranoia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stgeneral/paranoia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stgeneral/paranoia/teams","hooks_url":"https://api.github.com/repos/stgeneral/paranoia/hooks","issue_events_url":"https://api.github.com/repos/stgeneral/paranoia/issues/events{/number}","events_url":"https://api.github.com/repos/stgeneral/paranoia/events","assignees_url":"https://api.github.com/repos/stgeneral/paranoia/assignees{/user}","branches_url":"https://api.github.com/repos/stgeneral/paranoia/branches{/branch}","tags_url":"https://api.github.com/repos/stgeneral/paranoia/tags","blobs_url":"https://api.github.com/repos/stgeneral/paranoia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stgeneral/paranoia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stgeneral/paranoia/git/refs{/sha}","trees_url":"https://api.github.com/repos/stgeneral/paranoia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stgeneral/paranoia/statuses/{sha}","languages_url":"https://api.github.com/repos/stgeneral/paranoia/languages","stargazers_url":"https://api.github.com/repos/stgeneral/paranoia/stargazers","contributors_url":"https://api.github.com/repos/stgeneral/paranoia/contributors","subscribers_url":"https://api.github.com/repos/stgeneral/paranoia/subscribers","subscription_url":"https://api.github.com/repos/stgeneral/paranoia/subscription","commits_url":"https://api.github.com/repos/stgeneral/paranoia/commits{/sha}","git_commits_url":"https://api.github.com/repos/stgeneral/paranoia/git/commits{/sha}","comments_url":"https://api.github.com/repos/stgeneral/paranoia/comments{/number}","issue_comment_url":"https://api.github.com/repos/stgeneral/paranoia/issues/comments{/number}","contents_url":"https://api.github.com/repos/stgeneral/paranoia/contents/{+path}","compare_url":"https://api.github.com/repos/stgeneral/paranoia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stgeneral/paranoia/merges","archive_url":"https://api.github.com/repos/stgeneral/paranoia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stgeneral/paranoia/downloads","issues_url":"https://api.github.com/repos/stgeneral/paranoia/issues{/number}","pulls_url":"https://api.github.com/repos/stgeneral/paranoia/pulls{/number}","milestones_url":"https://api.github.com/repos/stgeneral/paranoia/milestones{/number}","notifications_url":"https://api.github.com/repos/stgeneral/paranoia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stgeneral/paranoia/labels{/name}","releases_url":"https://api.github.com/repos/stgeneral/paranoia/releases{/id}","created_at":"2015-02-13T15:41:31Z","updated_at":"2015-02-13T15:41:31Z","pushed_at":"2015-02-15T10:33:31Z","git_url":"git://github.com/stgeneral/paranoia.git","ssh_url":"git@github.com:stgeneral/paranoia.git","clone_url":"https://github.com/stgeneral/paranoia.git","svn_url":"https://github.com/stgeneral/paranoia","homepage":"","size":328,"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":"rails4"}},"base":{"label":"radar:rails4","ref":"rails4","sha":"d10a7713880e19b8ca6838ed4490c56cec57cc4f","user":{"login":"radar","id":2687,"avatar_url":"https://avatars.githubusercontent.com/u/2687?v=3","gravatar_id":"","url":"https://api.github.com/users/radar","html_url":"https://github.com/radar","followers_url":"https://api.github.com/users/radar/followers","following_url":"https://api.github.com/users/radar/following{/other_user}","gists_url":"https://api.github.com/users/radar/gists{/gist_id}","starred_url":"https://api.github.com/users/radar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radar/subscriptions","organizations_url":"https://api.github.com/users/radar/orgs","repos_url":"https://api.github.com/users/radar/repos","events_url":"https://api.github.com/users/radar/events{/privacy}","received_events_url":"https://api.github.com/users/radar/received_events","type":"User","site_admin":false},"repo":{"id":904810,"name":"paranoia","full_name":"radar/paranoia","owner":{"login":"radar","id":2687,"avatar_url":"https://avatars.githubusercontent.com/u/2687?v=3","gravatar_id":"","url":"https://api.github.com/users/radar","html_url":"https://github.com/radar","followers_url":"https://api.github.com/users/radar/followers","following_url":"https://api.github.com/users/radar/following{/other_user}","gists_url":"https://api.github.com/users/radar/gists{/gist_id}","starred_url":"https://api.github.com/users/radar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radar/subscriptions","organizations_url":"https://api.github.com/users/radar/orgs","repos_url":"https://api.github.com/users/radar/repos","events_url":"https://api.github.com/users/radar/events{/privacy}","received_events_url":"https://api.github.com/users/radar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/radar/paranoia","description":"acts_as_paranoid for Rails 3 & 4","fork":false,"url":"https://api.github.com/repos/radar/paranoia","forks_url":"https://api.github.com/repos/radar/paranoia/forks","keys_url":"https://api.github.com/repos/radar/paranoia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/radar/paranoia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/radar/paranoia/teams","hooks_url":"https://api.github.com/repos/radar/paranoia/hooks","issue_events_url":"https://api.github.com/repos/radar/paranoia/issues/events{/number}","events_url":"https://api.github.com/repos/radar/paranoia/events","assignees_url":"https://api.github.com/repos/radar/paranoia/assignees{/user}","branches_url":"https://api.github.com/repos/radar/paranoia/branches{/branch}","tags_url":"https://api.github.com/repos/radar/paranoia/tags","blobs_url":"https://api.github.com/repos/radar/paranoia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/radar/paranoia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/radar/paranoia/git/refs{/sha}","trees_url":"https://api.github.com/repos/radar/paranoia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/radar/paranoia/statuses/{sha}","languages_url":"https://api.github.com/repos/radar/paranoia/languages","stargazers_url":"https://api.github.com/repos/radar/paranoia/stargazers","contributors_url":"https://api.github.com/repos/radar/paranoia/contributors","subscribers_url":"https://api.github.com/repos/radar/paranoia/subscribers","subscription_url":"https://api.github.com/repos/radar/paranoia/subscription","commits_url":"https://api.github.com/repos/radar/paranoia/commits{/sha}","git_commits_url":"https://api.github.com/repos/radar/paranoia/git/commits{/sha}","comments_url":"https://api.github.com/repos/radar/paranoia/comments{/number}","issue_comment_url":"https://api.github.com/repos/radar/paranoia/issues/comments{/number}","contents_url":"https://api.github.com/repos/radar/paranoia/contents/{+path}","compare_url":"https://api.github.com/repos/radar/paranoia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/radar/paranoia/merges","archive_url":"https://api.github.com/repos/radar/paranoia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/radar/paranoia/downloads","issues_url":"https://api.github.com/repos/radar/paranoia/issues{/number}","pulls_url":"https://api.github.com/repos/radar/paranoia/pulls{/number}","milestones_url":"https://api.github.com/repos/radar/paranoia/milestones{/number}","notifications_url":"https://api.github.com/repos/radar/paranoia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/radar/paranoia/labels{/name}","releases_url":"https://api.github.com/repos/radar/paranoia/releases{/id}","created_at":"2010-09-12T08:57:53Z","updated_at":"2015-04-08T09:12:35Z","pushed_at":"2015-04-09T00:18:16Z","git_url":"git://github.com/radar/paranoia.git","ssh_url":"git@github.com:radar/paranoia.git","clone_url":"https://github.com/radar/paranoia.git","svn_url":"https://github.com/radar/paranoia","homepage":"","size":1682,"stargazers_count":931,"watchers_count":931,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":216,"mirror_url":null,"open_issues_count":26,"forks":216,"open_issues":26,"watchers":931,"default_branch":"rails4"}},"_links":{"self":{"href":"https://api.github.com/repos/radar/paranoia/pulls/212"},"html":{"href":"https://github.com/radar/paranoia/pull/212"},"issue":{"href":"https://api.github.com/repos/radar/paranoia/issues/212"},"comments":{"href":"https://api.github.com/repos/radar/paranoia/issues/212/comments"},"review_comments":{"href":"https://api.github.com/repos/radar/paranoia/pulls/212/comments"},"review_comment":{"href":"https://api.github.com/repos/radar/paranoia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/radar/paranoia/pulls/212/commits"},"statuses":{"href":"https://api.github.com/repos/radar/paranoia/statuses/066ab79082ab0a20aefc362b1a27a8836ab2e220"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"radar","id":2687,"avatar_url":"https://avatars.githubusercontent.com/u/2687?v=3","gravatar_id":"","url":"https://api.github.com/users/radar","html_url":"https://github.com/radar","followers_url":"https://api.github.com/users/radar/followers","following_url":"https://api.github.com/users/radar/following{/other_user}","gists_url":"https://api.github.com/users/radar/gists{/gist_id}","starred_url":"https://api.github.com/users/radar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radar/subscriptions","organizations_url":"https://api.github.com/users/radar/orgs","repos_url":"https://api.github.com/users/radar/repos","events_url":"https://api.github.com/users/radar/events{/privacy}","received_events_url":"https://api.github.com/users/radar/received_events","type":"User","site_admin":false},"comments":11,"review_comments":0,"commits":1,"additions":2,"deletions":2,"changed_files":1}}