Access another model from computed property

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?

I’m not a 100% sure what you mean by “access the list of gifts for the model gift” but you could probably just pull it from store.

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'), this.store.all('gift'));
    }.property('birthdate')
});

Of course, thanks alot for your help!