Closed samuelsimoes closed 9 years ago
Makes sense to remove to keep parity.
Would be interesting to see an error when to try define an attribute with name as a subset, example:
class Collection extends Fluxo.Collection {
static subset = {
online: ["stores:change:online"]
};
online () {
return this.where({online: true});
}
}
var c = new Collection;
c.setAttribute("stores", true); // => You can't use stores as attribute, there is a subset using that name
c.setAttribute("online", true); // => You can't use online as attribute, there is a subset using that name
Makes sense?
I totally agree! Lets first merge the subset feature and then we make this change and create the errors. :ok_hand:
A collection usually doesn't have too many attributes, generally it has just some computed properties (and subsets soon). Today, the collection's toJSON exports the collection's store data on
data
key and stores data onstores
key.This create a useless difference between a single store toJSON, that just export the data without any "padding key", and a collection store toJSON. This was a initial decision to avoid toJSON attributes clash, but collections having a few attributes and it being a problem only if developer use
store
and subsets name as collection store's attributes I think is reasonable remove thedata
key on collection's toJSON.