The collection sets this.params with options.params and this doesn't happen in models, I think would be good to have the same approach. I am not entirely sure how common would be.
My use case is, our API have sub resources associated to a resource:
GET /venues => collection of venues
GET /venues/:id => specific venues
GET /venues/:venueId/musicGenres => music genres from a specific venue
POST /venues/:venueId/musicGenres => add a music genres to a specific venue
DEL /venues/:venueId/musicGenres/:id => music genres from a specific venue
GET /musicGenres => list of available music genres
So when I execute fetch on MusicGenres collection with a venue id, I would like the options.params of the model be the same as collection, this would allow to do:
venueMusicGenresCollection.remove(id).destroy();
So since, my model url is conditional to params on model, this would execute:
DEL /venues/:venueId/musicGenres/:id => music genres from a specific venue
At the moment I will be overriding model constructor to due this after executing default implementation, but maybe would be reasonable to do it on rendr model, or not. :)
The collection sets this.params with options.params and this doesn't happen in models, I think would be good to have the same approach. I am not entirely sure how common would be.
https://github.com/rendrjs/rendr/blob/master/shared/base/collection.js#L38 https://github.com/rendrjs/rendr/blob/master/shared/base/model.js#L22
My use case is, our API have sub resources associated to a resource:
So when I execute fetch on MusicGenres collection with a venue id, I would like the options.params of the model be the same as collection, this would allow to do:
So since, my model url is conditional to params on model, this would execute:
At the moment I will be overriding model constructor to due this after executing default implementation, but maybe would be reasonable to do it on rendr model, or not. :)