| export default Ember.Route.extend({ | |
| afterModel: function() { | |
| localStorage.clear(); | |
| var self = this; | |
| var id = 1; | |
| // Run 2 times | |
| for (var n = 2; n > 0; n--) { | |
| self.store.findRecord("user", id).then(function(user) { | |
| console.info("User already exists with id ", user.get("id")); | |
| }, function() { | |
| var user = self.store.createRecord("user", { | |
| name: "Joe", | |
| id: id | |
| }); | |
| console.info("User was created with id", user.id); | |
| }) | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment