I have a model with a computed property that depends on another model. How can I access this list of items from the other model?
Here’s an example of what I am trying to do.
import { getPresents } from '../utils/get-presents';
var Birthday = DS.Model.extend({
name: DS.attr('string'),
birthdate: DS.attr('date'),
gifts: function() {
return getPresents(this.get('birthdate'), listGifts);
}.property('birthdate')
});
The utility function getPresents()
simply takes the value of birthdate
and calculates which gifts
to add using the list of all gifts.
How do I access the list of gifts for the model gift?