Creating Collections becomes much easier with the Base Collection.
In this example I will walk through some of the default conventions and requirements for creating such a collection.
Creating Collections becomes much easier with the Base Collection.
In this example I will walk through some of the default conventions and requirements for creating such a collection.
| to create a base extended collection, just extend base | |
| (function (Collections) { | |
| Collections.EmailAddresses = Collections.Base.extend({ | |
| model: Application.Models.Email, | |
| }); | |
| })(Application.Collections); |
| #base collections get the validate method, which will validate each of the models | |
| validate: -> @each (model) -> model.validate?() | |
| #if a collection is within a nested model this means that it will return the validation errors of each of its own models when | |
| #validate is called on the collection |