staugaard / ember-resource

This project has moved. The canonical repository is now located at: https://github.com/zendesk/ember-resource
https://github.com/zendesk/ember-resource
Apache License 2.0
122 stars 27 forks source link

Cannot add to collections that have not been successfully fetched #6

Open jamesarosen opened 13 years ago

jamesarosen commented 13 years ago

When a ResourceCollection is created, its content is undefined (unless you pass in an Array for the content, in which case it's a non-fetchable collection), which means that attempts to pushObject will fail silently. It's fine to say that you can't add items to the collection until it's been fetched. If the fetch fails, however, content is still undefined. I think the proper solution is to add a fail callback to the fetch deferred object that creates an empty content array.