{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/comments/27879369","id":27879369,"diff_hunk":"@@ -7,7 +7,7 @@ module Adapter\n       module ActiveRecord\n \n         Adapter.register self,\n-                         lambda { |klass| !!defined?(::ActiveRecord::Base) && klass.ancestors.include?(::ActiveRecord::Base) }\n+                         lambda { |klass| !!defined?(::ActiveRecord::Base) && klass.respond_to?(:ancestors) && klass.ancestors.include?(::ActiveRecord::Base) }","path":"elasticsearch-model/lib/elasticsearch/model/adapters/active_record.rb","position":5,"original_position":5,"commit_id":"9a74f4dec3579ca09e6384e3be5159f009ce081a","original_commit_id":"9a74f4dec3579ca09e6384e3be5159f009ce081a","user":{"login":"miguelff","id":210307,"avatar_url":"https://avatars.githubusercontent.com/u/210307?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelff","html_url":"https://github.com/miguelff","followers_url":"https://api.github.com/users/miguelff/followers","following_url":"https://api.github.com/users/miguelff/following{/other_user}","gists_url":"https://api.github.com/users/miguelff/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelff/subscriptions","organizations_url":"https://api.github.com/users/miguelff/orgs","repos_url":"https://api.github.com/users/miguelff/repos","events_url":"https://api.github.com/users/miguelff/events{/privacy}","received_events_url":"https://api.github.com/users/miguelff/received_events","type":"User","site_admin":false},"body":"`Multimodel.new` is an instance of Multimodel, and not an instance of Class, hence it doesn't respond to `ancestors`. An alternative approach will be that multimodel would implement:\r\n\r\n```ruby\r\ndef ancestors\r\n   []\r\nend\r\n```","created_at":"2015-04-07T13:56:21Z","updated_at":"2015-04-07T13:56:21Z","html_url":"https://github.com/elastic/elasticsearch-rails/pull/345#discussion_r27879369","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/comments/27879369"},"html":{"href":"https://github.com/elastic/elasticsearch-rails/pull/345#discussion_r27879369"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345","id":31188984,"html_url":"https://github.com/elastic/elasticsearch-rails/pull/345","diff_url":"https://github.com/elastic/elasticsearch-rails/pull/345.diff","patch_url":"https://github.com/elastic/elasticsearch-rails/pull/345.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/345","number":345,"state":"open","locked":false,"title":"[MODEL] Support for querying multiple models","user":{"login":"miguelff","id":210307,"avatar_url":"https://avatars.githubusercontent.com/u/210307?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelff","html_url":"https://github.com/miguelff","followers_url":"https://api.github.com/users/miguelff/followers","following_url":"https://api.github.com/users/miguelff/following{/other_user}","gists_url":"https://api.github.com/users/miguelff/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelff/subscriptions","organizations_url":"https://api.github.com/users/miguelff/orgs","repos_url":"https://api.github.com/users/miguelff/repos","events_url":"https://api.github.com/users/miguelff/events{/privacy}","received_events_url":"https://api.github.com/users/miguelff/received_events","type":"User","site_admin":false},"body":"This PR adds support for multiple models search, as discussed in:\r\n- https://github.com/elastic/elasticsearch-rails/issues/10\r\n- https://github.com/elastic/elasticsearch-rails/issues/30 \r\n- https://github.com/elastic/elasticsearch-rails/issues/50\r\n\r\nA previous attempt of implementing this was done in:\r\n- https://github.com/elastic/elasticsearch-rails/pull/129\r\n\r\nBut although the PR is open, it was rejected mainly due to:\r\n- Lack of documentation\r\n- Missing unit and integration tests\r\n- An inconsistent Search response API: Even though `#results` was part of the *multimodel-search* response, `#records` was not.\r\n\r\nThis PR tries to address the problems outlined above, and also implement a performant hit-to-record deserialization.\r\n\r\nThank you very much to @AaronRustad [for his PR](https://github.com/elastic/elasticsearch-rails/pull/129), which motivated this one.\r\n\r\n","created_at":"2015-03-14T19:48:23Z","updated_at":"2015-04-07T13:56:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9281ae040bdf6d64764c4164872c8e409d22319","assignee":{"login":"karmi","id":4790,"avatar_url":"https://avatars.githubusercontent.com/u/4790?v=3","gravatar_id":"","url":"https://api.github.com/users/karmi","html_url":"https://github.com/karmi","followers_url":"https://api.github.com/users/karmi/followers","following_url":"https://api.github.com/users/karmi/following{/other_user}","gists_url":"https://api.github.com/users/karmi/gists{/gist_id}","starred_url":"https://api.github.com/users/karmi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karmi/subscriptions","organizations_url":"https://api.github.com/users/karmi/orgs","repos_url":"https://api.github.com/users/karmi/repos","events_url":"https://api.github.com/users/karmi/events{/privacy}","received_events_url":"https://api.github.com/users/karmi/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/345/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch-rails/statuses/9a74f4dec3579ca09e6384e3be5159f009ce081a","head":{"label":"miguelff:multimodel-support","ref":"multimodel-support","sha":"9a74f4dec3579ca09e6384e3be5159f009ce081a","user":{"login":"miguelff","id":210307,"avatar_url":"https://avatars.githubusercontent.com/u/210307?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelff","html_url":"https://github.com/miguelff","followers_url":"https://api.github.com/users/miguelff/followers","following_url":"https://api.github.com/users/miguelff/following{/other_user}","gists_url":"https://api.github.com/users/miguelff/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelff/subscriptions","organizations_url":"https://api.github.com/users/miguelff/orgs","repos_url":"https://api.github.com/users/miguelff/repos","events_url":"https://api.github.com/users/miguelff/events{/privacy}","received_events_url":"https://api.github.com/users/miguelff/received_events","type":"User","site_admin":false},"repo":{"id":31852869,"name":"elasticsearch-rails","full_name":"miguelff/elasticsearch-rails","owner":{"login":"miguelff","id":210307,"avatar_url":"https://avatars.githubusercontent.com/u/210307?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelff","html_url":"https://github.com/miguelff","followers_url":"https://api.github.com/users/miguelff/followers","following_url":"https://api.github.com/users/miguelff/following{/other_user}","gists_url":"https://api.github.com/users/miguelff/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelff/subscriptions","organizations_url":"https://api.github.com/users/miguelff/orgs","repos_url":"https://api.github.com/users/miguelff/repos","events_url":"https://api.github.com/users/miguelff/events{/privacy}","received_events_url":"https://api.github.com/users/miguelff/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miguelff/elasticsearch-rails","description":"Elasticsearch integrations for ActiveModel/Record and Ruby on Rails","fork":true,"url":"https://api.github.com/repos/miguelff/elasticsearch-rails","forks_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/forks","keys_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/teams","hooks_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/hooks","issue_events_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/issues/events{/number}","events_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/events","assignees_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/assignees{/user}","branches_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/branches{/branch}","tags_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/tags","blobs_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/statuses/{sha}","languages_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/languages","stargazers_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/stargazers","contributors_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/contributors","subscribers_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/subscribers","subscription_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/subscription","commits_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/contents/{+path}","compare_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/merges","archive_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/downloads","issues_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/issues{/number}","pulls_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/pulls{/number}","milestones_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/milestones{/number}","notifications_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/labels{/name}","releases_url":"https://api.github.com/repos/miguelff/elasticsearch-rails/releases{/id}","created_at":"2015-03-08T14:37:32Z","updated_at":"2015-03-08T14:37:33Z","pushed_at":"2015-03-23T15:11:23Z","git_url":"git://github.com/miguelff/elasticsearch-rails.git","ssh_url":"git@github.com:miguelff/elasticsearch-rails.git","clone_url":"https://github.com/miguelff/elasticsearch-rails.git","svn_url":"https://github.com/miguelff/elasticsearch-rails","homepage":"","size":4951,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"2f2c0fb7a25ece68fd3a9eec7b9026848e66fa4f","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":14238949,"name":"elasticsearch-rails","full_name":"elastic/elasticsearch-rails","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch-rails","description":"Elasticsearch integrations for ActiveModel/Record and Ruby on Rails","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch-rails","forks_url":"https://api.github.com/repos/elastic/elasticsearch-rails/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch-rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch-rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch-rails/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch-rails/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch-rails/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch-rails/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch-rails/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch-rails/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch-rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch-rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch-rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch-rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch-rails/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch-rails/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch-rails/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch-rails/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch-rails/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch-rails/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch-rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch-rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch-rails/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch-rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch-rails/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch-rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch-rails/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch-rails/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch-rails/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch-rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch-rails/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch-rails/releases{/id}","created_at":"2013-11-08T17:00:19Z","updated_at":"2015-04-07T13:52:05Z","pushed_at":"2015-04-07T13:52:03Z","git_url":"git://github.com/elastic/elasticsearch-rails.git","ssh_url":"git@github.com:elastic/elasticsearch-rails.git","clone_url":"https://github.com/elastic/elasticsearch-rails.git","svn_url":"https://github.com/elastic/elasticsearch-rails","homepage":"","size":7414,"stargazers_count":1047,"watchers_count":1047,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":208,"mirror_url":null,"open_issues_count":84,"forks":208,"open_issues":84,"watchers":1047,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345"},"html":{"href":"https://github.com/elastic/elasticsearch-rails/pull/345"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/345"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/issues/345/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/pulls/345/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch-rails/statuses/9a74f4dec3579ca09e6384e3be5159f009ce081a"}}}}