I started the migration of a small inhouse project from RC7 to 1.0.0. Below is an overview of the areas I had to work on (breaking changes and resolution of deprecated areas). I hope this overview is useful for others. Do not hesitate to post your own experiences as a comment on this post.
1. Error when using Ember.js 1.0.0 in combination with Ember Data 0.13
When you have a project in which you use the combination of Ember.js 1.0.0 with Ember Data 0.13, you will get the following error:
Uncaught Error: Ember.State has been moved into a plugin: https://github.com/emberjs/ember-states
Ember itself does not use Ember.State, but Ember Data 0.13 requires it.
Solution: include the Ember State library (https://github.com/emberjs/ember-states).
As of Ember Data 1.0.0 Beta, Ember.State is no longer needed.
See ember.js - Ember 1.0.0: Ember.State has been moved into a plugin: https://github.com/emberjs/ember-states - Stack Overflow for more info.
2. Documentation recommends using Ember Data 0.14
Although the documentation recommends to use Ember Data 0.14 (and no longer 0.13), there is no link to the 0.14 build version on http://builds.emberjs.com/ .
Solution: build the lib yourself or stick to 0.13
You could also start looking into a migration to Ember Data 1.0.0 Beta, which is a reboot of Ember data and will require some profound changes.
3. Deprecation: Application.resolver should be Application.Resolver
I use Application.Resolver to dynamically load hbs templates. Simple change of Application.resolver to Application.Resolver was needed.
4. Deprecation: Methods implemented directly on controllers should be put under āactionsā object
In most of my controllers, I have a number of methods directly implemented on the controller. This will result in the warning:
DEPRECATION: Action handlers implemented directly on controllers are deprecated in favor of action handlers on an `actions` object
Solution: Define the actions inside the actions hash of the controller:
App.ApplicationController = Em.ObjectController.extend({
actions : {
// your actions here
}
});
Important: please note that after this change, actions can no longer be invoked directly, thus:
this.controllerFor('category.edit').save();
Should be changed into:
this.controllerFor('category.edit').send("save");
The above required a lot of changes in my code; very sensitive to mistakes ā¦
5. Deprecation: Action handlers contained in events at route level should be put under āactionsā object
If you use the events hash of the route, then change it to actions:
events: { xxx }
Should be changed into:
actions: { xxx }
6. JQuery version
It is unclear to me which version of JQuery is recommended. In general, a compatibility overview of library dependencies should be welcome ā¦
7. Ember Data 1.0.0 Beta
Ember Data 1.0.0 beta is a reboot of Ember data 0.13/0.14. There is a good document describing the changes (and there are a lot) ā¦ See: https://github.com/emberjs/data/blob/master/TRANSITION.md
So far, I have managed to read data via the RESTAdapter and to save a simple record. There are however a number of open questions I have before being able to further migrate the code to Ember Data 1.0.0. The questions are listed below (posted on stackoverflow). Hope somebody can help.
-
RESTAdapter endpoint customization no longer works ember.js - Ember data 1.0.0 Beta: RESTAdapter endpoint customization no longer works - Stack Overflow
-
confused with per-type adapters and serializers ember.js - Ember data 1.0.0: confused with per-type adapters and serializers - Stack Overflow
-
How does pluralization works? ember.js - Ember Data 1.0.0: How does pluralization works? - Stack Overflow
-
this.modelFor(āauthorā).save fails - how to save a newly created record in the controller? ember.js - Ember Data 1.0.0: this.modelFor('author').save fails - how to save a newly created record in the controller? - Stack Overflow)
I will complete this overview as soon as I get Ember Data 1.0.0 operational.
All in all, migration from RC7 to 1.0.0 went smooth !
Migration to Ember Data 1.0.0 is more profound and I hope to complete this soon.
Marc