如何将ember-rails版本的ember-data升级到12版?

时间:2013-03-28 19:20:15

标签: ember-data ember-rails

我已更新ember-rails以掌握:

bundle update ember-rails
Updating git://github.com/emberjs/ember-rails.git
Fetching gem metadata from https://rubygems.org/.........
....
Using ember-rails (0.11.1) from git://github.com/emberjs/ember-rails.git (at master) 
....
Your bundle is updated!

我想使用最新的ember-data修订版(12),但每次我将应用程序的商店修订版号更新为12,即:

App.Store = DS.Store.extend({
  revision: 12,
  adapter: App.Adapter.create()
});

我看到以下错误消息:

Uncaught Error: Error: The Ember Data library has had breaking API changes since the last time you updated the library. Please review the list of breaking changes at https://github.com/emberjs/data/blob/master/BREAKING_CHANGES.md, then update your store's `revision` property to 11

...当我查看DS.CURRENT_API_REVISION时,它是11:

console.log(DS.CURRENT_API_REVISION); // 11

有没有办法让gem进入版本12,或者我是否必须自己构建ember-data并覆盖包含的版本?

2 个答案:

答案 0 :(得分:2)

benburton的解决方案适用于所要求的内容,但是在最新的余烬数据中it uses an internal method 'readOnly' that was only added to in ember RC2

因此,您需要最新的余烬才能运行最新的余烬数据。完整的解决方案是简单地忽略解决方案的第二行,留下以下内容:

rails generate ember:install --head

答案 1 :(得分:1)

我最终使用ember-rails生成ember + ember-data,然后删除更新版本的Ember,如下所示:

rails generate ember:install --head
rm vendor/assets/ember/development/ember.js vendor/assets/ember/production/ember.js