Ember-Brunch (元のリポジトリ: https://github.com/icholy/ember-brunch ) を最新の EmberJS および EmberJS-Data フレームワークに更新しようとしています。私が抱えている現在の問題は、元の Bob モデルを でDS.Model
を使用してDS.FixtureAdapter
に変換しようとしていることですDS.Store
。しかし、何をしようとしても、データを表示する際に問題が発生します。ここにいくつかの試みがあります:
ルートで:
App.BobRoute = Ember.Route.extend({
model: function() {
return App.Bob.find();
}
});
次のエラーが表示されます。
キャッチされていない TypeError: null のメソッド 'hasOwnProperty' を呼び出せません
そして、このルートに切り替えると:
App.BobRoute = Ember.Route.extend({
setupController: function() {
App.BobController.set('content', App.Bob.find());
}
});
次のエラーが表示されます。
Uncaught TypeError: Object App.BobController has no method 'set' app.js:184 Uncaught TypeError: null のメソッド 'hasOwnProperty' を呼び出せません
何か案は?
私の現在の作業https://github.com/seankeating/ember-brunchと、DS.Model-Implementation-For-Using-Local-DSStore ブランチでこれを行う試みを確認できます。
店:
App.Store = DS.Store.extend({
revision: 11,
adapter: DS.FixtureAdapter.create()
});
コントローラ:
App.BobController = Em.ObjectController.extend({
});
モデル:
var App = require('app'),
attr = DS.attr;
App.Bob = DS.Model.extend({
firstName : attr('string'),
lastName : attr('string'),
lyrics : attr('string'),
fullName: function(){
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName')
});
App.Bob.FIXTURES = [{
firstName: 'bob',
lastName: 'marley',
lyrics: 'no woman no cry!'
}];
テンプレート:
<h2>{{fullName}}'s page!</h2>
<button class="btn btn-success" {{action doClick target="view"}}>click me</button>
{{#linkTo home}}<button class="btn" {{action doHome}}>go back home</button>{{/linkTo}}