Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use the hooks offered by Ember Data
    primarykey
    data
    text
    <p>I am trying to utilize the hooks that are commented on through the Ember Data source code, but I can't seem to implement the methods in a way where they get called.</p> <p>I am currently trying to use the <code>keyForPolyMorphicType</code> which is a hook in <code>DS.JSONSerializer</code>, which is <code>A hook you can use in your serializer subclass to customize how a polymorphic association's name is converted into a key for the type.</code> and here is how I currently have it set up</p> <pre><code>var jsonSerializer = DS.JSONSerializer.extend({ keyForPolymorphicType: function(name) { debugger } }) var serializer = jsonSerializer.create() DS.RESTAdapter.configure('ServerDemo.Component', { alias: 'component' }); ServerDemo.Adapter = DS.RESTAdapter.extend({ bulkCommit: false ,serializer: serializer }); ServerDemo.Store = DS.Store.extend({ revision: 12, adapter: ServerDemo.Adapter.create() }); </code></pre> <p>If anyone could offer guidance on how to use the hooks sprinkled throughout the source, that would be helpful</p> <p>EDIT</p> <p>Here are my models</p> <pre><code>ServerDemo.Note = DS.Model.extend title: DS.attr 'string' content: DS.attr 'string' index: DS.attr 'number' noteable: DS.belongsTo 'ServerDemo.Noteable' ServerDemo.Noteable = DS.Model.extend note_ids: DS.hasMany 'ServerDemo.Note' ServerDemo.Part = ServerDemo.Noteable.extend rack_pos: DS.attr 'number' server_config_id: DS.belongsTo 'ServerDemo.ServerConfig' partable: DS.belongsTo 'ServerDemo.Partable', { polymorphic: true } note_ids: DS.hasMany 'ServerDemo.Note' semanticRackPos: (-&gt; "rack_pos_#{this.get('rack_pos')}" ).property('rack_pos') ServerDemo.Partable = DS.Model.extend part_ids: DS.hasMany 'ServerDemo.Part' ServerDemo.Component = ServerDemo.Partable.extend back_image: DS.attr 'string' cols: DS.attr 'number' rows: DS.attr 'number' front_image: DS.attr 'string' name: DS.attr 'string' </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload