-
-
Save NullVoxPopuli/46a491da1f665904b4647f181a85aa2f to your computer and use it in GitHub Desktop.
ember not recognizing plural type in payload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
init() { | |
this._super(...arguments); | |
$.mockjax({ | |
url: '/api/mock', | |
responseText: { | |
"data": | |
{ | |
"id":"2506","type":"order", | |
"attributes":{"paid-amount":"109.29","net-amount-received":"105.0","total-fee-amount":"4.29","paid":true,"payment-method":"Stripe","host-name":"SwingIN 2016","host-url":"//swing.vhost/swingin2016","created-at":"2016-06-19T20:30:53.218-04:00","payment-received-at":"2016-06-19T20:32:01.000-04:00","total-in-cents":10929,"stripe-refunds":[{"amount":2075,"created":1466392180,"status":"succeeded"}],"current-paid-amount":"88.54","current-total-fee-amount":"3.69","current-net-amount-received":"84.85"}, | |
"relationships":{ | |
"order-line-items":{ | |
"data":[ | |
{"id":"3313","type":"order-line-item"}, | |
{"id":"3314","type":"order-line-item"}]}, | |
"host":{"data":{"id":"23","type":"events"}}, | |
"attendance":{"data":{"id":"1814","type":"event-attendances"}}, | |
"pricing-tier":{"data":{"id":"57","type":"pricing-tiers"}}}} | |
} | |
}); | |
}, | |
model() { | |
return $.getJSON('/api/mock'); | |
}, | |
actions: { | |
refreshStripe() { | |
console.log('action called'); | |
Ember.$.ajax({ | |
url: '/api/mock', | |
type: 'GET' | |
}).then(data => { | |
this.get('store').push(data); | |
}, error => { | |
let json = JSON.parse(error.responseText); | |
console.log(json); | |
}); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
host: belongsTo('host'), | |
orders: hasMany('order') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
import Attendance from './attendance'; | |
export default Model.extend(Attendance, { | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
import Host from './host'; | |
export default Model.extend(Host, { | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
orders: hasMany('orders') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
order: belongsTo('order') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
host: belongsTo('host', { polymorphic: true }), | |
orderLineItems: hasMany('order-line-item'), | |
attendance: belongsTo('attendance', { polymorphic: true }), | |
pricingTier: belongsTo('pricing-tier'), | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
orders: hasMany('order'), | |
event: belongsTo('event') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.4.8", | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.6.0", | |
"ember-data": "2.6.1", | |
"ember-template-compiler": "2.6.0", | |
"jquery-mockjax": "https://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.6.2/jquery.mockjax.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment