nicklandgrebe/active-resource.js

Getting relations using filtering strategy

antonkomarev opened this issue · 2 comments

Project.find('1').then(project => {
    project.tasks().all();
});

This code produces query: /projects/1/tasks

But I need to utilize filters instead:
/tasks?filter[project][type]=Project&filter[project][id]=1

Is there is an easy way to do it?

project.tasks().where({ project: { type: 'Project', id: '1' }})

Though why, if you are requesting /projects/1, do you need to specify the project id? Or the type for that matter?