title: Rails-style polymorphic model in ember-data
body: <p>If I have the following models in Rails, how would I represent this in Ember/Ember Data?</p>
  
  <pre><code>class Attachment &lt; ActiveRecord::Base
    belongs_to :user
    belongs_to :attachable, polymorphic: true
  end
  
  class Profile &lt; ActiveRecord::Base
    belongs_to :user
    has_one :photo, class_name: 'Attachment', as: :attachable
  end
  
  class Post &lt; ActiveRecord::Base
    belongs_to :user
    has_many :attachments, as: :attachable
  end
  </code></pre>
  
  <p>References I've found are <a href="https://github.com/emberjs/data/pull/750" rel="nofollow noreferrer">the relevant ember-data pull request</a>, <a href="https://github.com/emberjs/data/blob/master/packages/ember-data/tests/integration/relationships/embedded_polymorphic_has_many_test.js" rel="nofollow noreferrer">the ember-data tests for polymorphic relationships</a>, and <a href="https://stackoverflow.com/questions/16045708/polymorphic-hasmany-and-belongsto-relationships-in-ember-data-rev-12">this related question</a> but it's difficult to work out a canonical example from them.</p>