{"action":"created","issue":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-rails/issues/332","labels_url":"https://api.github.com/repos/elasticsearch/elasticsearch-rails/issues/332/labels{/name}","comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch-rails/issues/332/comments","events_url":"https://api.github.com/repos/elasticsearch/elasticsearch-rails/issues/332/events","html_url":"https://github.com/elasticsearch/elasticsearch-rails/pull/332","id":57978016,"number":332,"title":"Support inherited index names and doc types","user":{"login":"rymohr","id":730211,"avatar_url":"https://avatars.githubusercontent.com/u/730211?v=3","gravatar_id":"","url":"https://api.github.com/users/rymohr","html_url":"https://github.com/rymohr","followers_url":"https://api.github.com/users/rymohr/followers","following_url":"https://api.github.com/users/rymohr/following{/other_user}","gists_url":"https://api.github.com/users/rymohr/gists{/gist_id}","starred_url":"https://api.github.com/users/rymohr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rymohr/subscriptions","organizations_url":"https://api.github.com/users/rymohr/orgs","repos_url":"https://api.github.com/users/rymohr/repos","events_url":"https://api.github.com/users/rymohr/events{/privacy}","received_events_url":"https://api.github.com/users/rymohr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-17T20:32:56Z","updated_at":"2015-02-17T23:34:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-rails/pulls/332","html_url":"https://github.com/elasticsearch/elasticsearch-rails/pull/332","diff_url":"https://github.com/elasticsearch/elasticsearch-rails/pull/332.diff","patch_url":"https://github.com/elasticsearch/elasticsearch-rails/pull/332.patch"},"body":"This PR adds support for inheriting `index_name` and `document_type` on an opt-in basis:\r\n\r\n```ruby\r\n# within an initializer\r\nElasticsearch::Model.inheritance_enabled = true\r\n\r\nclass Animal < ActiveRecord::Base\r\n  document_type 'mammal'\r\n  index_name 'mammals'\r\nend\r\n\r\nclass Dog < Animal\r\nend\r\n\r\nAnimal.document_type   # 'mammal'\r\nAnimal.index_name      # 'mammals'\r\nDog.document_type      # 'mammal'\r\nDog.index_name         # 'mammals'\r\n```\r\n\r\nWe wrap all our models exposed through our api in an `Api::` wrapper that helps us handle versioning issues.  Without support for inherited values it's easy to forget to add the explicit values to the subclasses, or update them if the base class ever changed.\r\n\r\nRelated to https://github.com/elasticsearch/elasticsearch-rails/issues/28 and https://github.com/elasticsearch/elasticsearch-rails/issues/92. Not sure it's enough for https://github.com/elasticsearch/elasticsearch-rails/issues/170."},"comment":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-rails/issues/comments/74779335","html_url":"https://github.com/elasticsearch/elasticsearch-rails/pull/332#issuecomment-74779335","issue_url":"https://api.github.com/repos/elasticsearch/elasticsearch-rails/issues/332","id":74779335,"user":{"login":"rymohr","id":730211,"avatar_url":"https://avatars.githubusercontent.com/u/730211?v=3","gravatar_id":"","url":"https://api.github.com/users/rymohr","html_url":"https://github.com/rymohr","followers_url":"https://api.github.com/users/rymohr/followers","following_url":"https://api.github.com/users/rymohr/following{/other_user}","gists_url":"https://api.github.com/users/rymohr/gists{/gist_id}","starred_url":"https://api.github.com/users/rymohr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rymohr/subscriptions","organizations_url":"https://api.github.com/users/rymohr/orgs","repos_url":"https://api.github.com/users/rymohr/repos","events_url":"https://api.github.com/users/rymohr/events{/privacy}","received_events_url":"https://api.github.com/users/rymohr/received_events","type":"User","site_admin":false},"created_at":"2015-02-17T23:34:45Z","updated_at":"2015-02-17T23:34:45Z","body":"CLA should be signed now."}}