Skip to content

Model related via belongsTo is not available via REST #97

Description

@bajtos

Consider the following setup: "Product belongsTo Category".

For a product with id 1, one can get the category it belongs to via

Product.findById(1, function(err, prod) {
  prod.category(function(err, cat) {
    // see "cat"
  });
});

The method is not exposed via the REST API, although it should be.

GET /products/1/category
404 Not Found

The primary reason is that the relation function is not enumerable (code).

Note that changing 'enumerable' to true is not enough, as the method is invoked with a wrong "this" argument when called via remoting.

@raymondfeng I am wondering how did you test the pull request #86 which was supposed to fix the issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions