Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when cancelling an edit on friend #21

Open
DrSayre opened this issue Mar 16, 2016 · 2 comments
Open

Error when cancelling an edit on friend #21

DrSayre opened this issue Mar 16, 2016 · 2 comments

Comments

@DrSayre
Copy link

DrSayre commented Mar 16, 2016

I keep getting an error on page 79. This is how I have my friends edit route:

import Ember from 'ember';

export default Ember.Route.extend({
    resetController(controller, isExiting) {
    if (isExiting) {
      var model = this.get('model');
      model.rollback();
    }
  }
});

When I try to cancel an edit on a friend, I get this error:

Error while processing route: friends.show.index (2)
"model.rollback is not a function. (In 'model.rollback()', 'model.rollback' is undefined)"

Has anybody else had this problem?

@bdsabian
Copy link

Just ran into this as well. There are actually two issues here. One in your code, one in the book. In your code, you have:
var model = this.get('model');
That should be
var model = controller.get('model');

The other issue is that either ember-data's api has changed slightly or the book just has the wrong method name. Rather than
model.rollback()
It should be
model.rollbackAtributes();

Hopefully you've already figured that out since you asked this a few months ago, but figured I'd post for any others that run into this problem.

@abuiles
Copy link
Owner

abuiles commented Jun 12, 2016

Hey Brendon, when did you download the book?

This should be fixed in the current version and the repo is now
abuiles/borrowers-2016
On Sat, Jun 11, 2016 at 3:43 PM Brendon Davidson [email protected]
wrote:

Just ran into this as well. There are actually two issues here. One in
your code, one in the book. In your code, you have:
var model = this.get('model');
That should be
var model = controller.get('model');

The other issue is that either ember-data's api has changed slightly or
the book just has the wrong method name. Rather than
model.rollback()
It should be
model.rollbackAtributes();

Hopefully you've already figured that out since you asked this a few
months ago, but figured I'd post for any others that run into this problem.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#21 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AABVDJhM--LhoLJLljXmd9fiXhs3lvkcks5qKx3VgaJpZM4HxoL4
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants