我正在尝试跟随Tom Dale 的 youtube 视频来构建一个简单的博客。我已经从 GH 克隆了 ember-data master 并构建了它,但是我收到了两个错误:
Uncaught TypeError: Object [object Object] has no method 'readOnly'
那是来自 ember-data 和
Uncaught TypeError: Object [object Object] has no method 'attr'
来自我在模型中第一次使用 DS.attr。我的代码可以在GitHub以及下面找到
/* Ember and Ember-Data are shimmed in as deps */
define([], function () {
'use strict';
var App = Ember.Application.create();
App.Store = DS.Store.extend({
revision: 12,
adapter: 'DS.FixtureAdapter'
});
App.Router.map(function () {
this.resource('about');
});
App.Post = DS.Model.extend({
title: DS.attr('string'),
author: DS.attr('string'),
intro: DS.attr('string'),
extended: DS.attr('string'),
publishedAt: DS.attr('date')
});
App.Post.FIXTURES = [{
id: 1,
title: "Rails is Omakase",
author: "d2h",
publishedAt: new Date('12-27-2012'),
intro: "There are lots of a la carte software",
extended: "I want this for my ORM"
}];
return App;
});