Skip to content

loadRelations does not use the relationship definitions correctly #240

Closed
@ee0pdt

Description

@ee0pdt

In the function to load relations (loadRelations) DS is not parsing the parameters from the model relationship definition into a correct format for findAll().

e.g. my model definition includes:

   hasMany: {
        image: {
          localField: 'images',
          foreignKey: 'gallery_id',
        }
      }

And the line in loadRelations() that receives this is:

task = DS.findAll(relationName, params, options);

but here params is defined as:

Object {gallery_id: 6} 

This is not compatible with your expect definition of params:

Object {where: Object}
    where: Object
       gallery_id: Object
           ==: 6

Therefore the findAll returns every instance of image instead of filtering by the 'where' clause.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions