Created
December 3, 2015 14:27
-
-
Save jcloutz/f07e6cbe4eee273d36e4 to your computer and use it in GitHub Desktop.
Ember JS Relationships Not updating
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 DS from 'ember-data'; | |
export default DS.Model.extend({ | |
item_no: DS.attr('string'), | |
name: DS.attr('string'), | |
notes: DS.attr('string'), | |
barcode: DS.attr('string'), | |
vendor_item_no: DS.attr('string'), | |
vendor_dept: DS.attr('string'), | |
orders: DS.hasMany('order', {async: true}), | |
search_name: Ember.computed('item_no', 'name', function() { | |
return this.get('item_no') + ' - ' + this.get('name'); | |
}) | |
}); |
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 DS from 'ember-data'; | |
import Ember from 'ember'; | |
export default DS.Model.extend({ | |
requested_qty: DS.attr('number'), | |
notes: DS.attr('string'), | |
due_date: DS.attr('date'), | |
job: DS.belongsTo('job', {async: true}), | |
item: DS.belongsTo('item', {async: true}), | |
status: DS.attr('string', {defaultValue: 'Open'}), | |
createdAt: DS.attr('date', { | |
defaultValue() { return new Date(); } | |
}), | |
order_no: Ember.computed('id', { | |
get() { | |
let order_no = parseInt(this.get('id')) + 10000; | |
return order_no; | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment