Problem with data access

#1

Hi, I just started learning about ember and I ran into a problem. i have mirage/factories/payment

mirage/factories/donor

app/models/donor

app/models/payment

How to use payment data in the app/models/donor. I need to pull out all donates that were created

#2

Looks like your mirage setup looks good. If you’re developing/prototyping you’ll need to create some data in your mirage scenario (just a donor, and then the 3 payments will be created automatically) and then load them in your app.

As far as how to access them once the donor record is loaded in your app (presumably a findRecord('donor', donorId) in a route model hook) just reference the relationship via donor.get('pay') or, in a template:

{{#each donor.pay as |payment|}}
  {{payment.donation}}
{{/each}}

Is that what you were trying to do?