{"action":"created","issue":{"url":"https://api.github.com/repos/globalize/globalize/issues/391","labels_url":"https://api.github.com/repos/globalize/globalize/issues/391/labels{/name}","comments_url":"https://api.github.com/repos/globalize/globalize/issues/391/comments","events_url":"https://api.github.com/repos/globalize/globalize/issues/391/events","html_url":"https://github.com/globalize/globalize/issues/391","id":53257866,"number":391,"title":"Eager loading fails on STI","user":{"login":"sbuhr","id":220006,"avatar_url":"https://avatars.githubusercontent.com/u/220006?v=3","gravatar_id":"","url":"https://api.github.com/users/sbuhr","html_url":"https://github.com/sbuhr","followers_url":"https://api.github.com/users/sbuhr/followers","following_url":"https://api.github.com/users/sbuhr/following{/other_user}","gists_url":"https://api.github.com/users/sbuhr/gists{/gist_id}","starred_url":"https://api.github.com/users/sbuhr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbuhr/subscriptions","organizations_url":"https://api.github.com/users/sbuhr/orgs","repos_url":"https://api.github.com/users/sbuhr/repos","events_url":"https://api.github.com/users/sbuhr/events{/privacy}","received_events_url":"https://api.github.com/users/sbuhr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-02T15:23:15Z","updated_at":"2015-02-16T19:23:28Z","closed_at":null,"body":"Is there any way to eager load the translations? I always end up in n+1 queries.\r\n\r\n`Model.includes(:translations)` doesn't work. This occurs in a STI table only.\r\n\r\nAny help appreciated.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/globalize/globalize/issues/comments/74559559","html_url":"https://github.com/globalize/globalize/issues/391#issuecomment-74559559","issue_url":"https://api.github.com/repos/globalize/globalize/issues/391","id":74559559,"user":{"login":"sbuhr","id":220006,"avatar_url":"https://avatars.githubusercontent.com/u/220006?v=3","gravatar_id":"","url":"https://api.github.com/users/sbuhr","html_url":"https://github.com/sbuhr","followers_url":"https://api.github.com/users/sbuhr/followers","following_url":"https://api.github.com/users/sbuhr/following{/other_user}","gists_url":"https://api.github.com/users/sbuhr/gists{/gist_id}","starred_url":"https://api.github.com/users/sbuhr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbuhr/subscriptions","organizations_url":"https://api.github.com/users/sbuhr/orgs","repos_url":"https://api.github.com/users/sbuhr/repos","events_url":"https://api.github.com/users/sbuhr/events{/privacy}","received_events_url":"https://api.github.com/users/sbuhr/received_events","type":"User","site_admin":false},"created_at":"2015-02-16T19:23:28Z","updated_at":"2015-02-16T19:23:28Z","body":"sport_entity.rb\r\n\r\n```\r\nclass SportEntity < ActiveRecord::Base\r\n  resourcify\r\n  has_paper_trail :ignore => [:updated_at,:sort]\r\n  acts_as_nested_set :order_column => :sort\r\n  validates_presence_of(:name)\r\n  alias_attribute :state, :aasm_state\r\n  has_and_belongs_to_many :tip_types\r\n\r\n has_one :limit_set\r\n\r\n  translates :name\r\n  \r\n  include AASM\r\n  \r\n  aasm do\r\n    state :pending, initial: true\r\n    state :active\r\n    state :stopped\r\n\r\n    event :activate do\r\n      transitions from: [:pending, :stopped], to: :active\r\n    end\r\n\r\n    event :stop do\r\n      transitions from: [:pending, :active], to: :stopped\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nsport.rb\r\n\r\n```\r\nclass Sport < SportEntity\r\n  validates_uniqueness_of :super_id, :allow_nil => true\r\n  has_many :matches, :primary_key => :super_id\r\n  scope :oddscreator, -> { where(valid_for_oddscreator: true) }\r\nend\r\n```\r\n\r\n"}}