radar / guides

Guides for Ruby and Elixir and whatever else I feel like
1.52k stars 164 forks source link

undefined happen when success to create post and need to transitionToRoute #53

Closed Eric-Guo closed 10 years ago

Eric-Guo commented 10 years ago

I strictly following the guide, reaching the creating a new post section but meet following error.

undefined_on_save

I'm newbie to EmberJS, so may I make some mistake, so can anyone check my code and point out if the guide/me missing something?

paulm67 commented 10 years ago

I'm a newbie with EmberJS and like you had some problems with this guide.

To solve my specific problem, which had symptoms like yours, I used the Console to figure out exactly which bit of the code was causing the "undefined is not a function" error.

If you enter "x=this.currentModel" into your Console, what value does it display? If you enter "x=this.currentModel.save" into your Console, does the error now appear?

Eric-Guo commented 10 years ago

Please see below screen, seem the route just have no method name transitionToRoute? route_has_no_transitiontoroute

paulm67 commented 10 years ago

route does have a method "transitionTo", though, which is what I have in my new.js.coffee script. I'm not sure what the difference is, or why the guide uses transitionToRoute in some places and transitionTo in other places.

The following throws some light on the matter, perhaps: http://www.smashingmagazine.com/2013/11/07/an-in-depth-introduction-to-ember-js-2/#transitionTo_or_transitionToRoute

PS I like that you included screenshots - it makes it so much easier to see what people are talking about!

radar commented 10 years ago

I was seeing an error when I was writing the guide that transitionTo was deprecated, but I cannot remember what context. It appears that transitionTo is the right method, and so the guide should use that.

radar commented 10 years ago

This is now fixed in the guide.