Skip to content

destroyById with undefined fk:ID issues destroyAll #112

Closed

Description

@temp3l

User.products.destroyById({id:1, fk:undefined});
and
User.products.destroyAll({id:1})

both send DELETE to /api/users/1/products

Activity

  1. bajtos commented on Nov 28, 2014

    @bajtos
    Member

    What did you expect to see instead?

  2. temp3l commented on Dec 7, 2014

    @temp3l
    Author

    thought it might throw an error or warning instead of deleting all my products...
    But I should catch "undefined fk" on my own ;)

  3. jrschumacher commented on Sep 28, 2015

    @jrschumacher

    @bajtos where can I find the method which strips out the keys with undefined values? Personally I'd either like an error thrown or convert undefined to null.

  4. bajtos commented on Sep 29, 2015

    @bajtos
    Member

    @jrschumacher If the fk parameter is encoded in the request URL (sorry, don't have enough time to check it myself), then you need to look at Angular's ngResource: https://github.com/angular/angular.js/blob/v1.4.x/src/ngResource/resource.js#L448-L461

  5. bajtos commented on Sep 29, 2015

    @bajtos
    Member

    To be honest, I think this issue is another good argument why we should drop ngResource and generate a client API that is more-or-less the same as the server API - see #133.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions