Ember Data Beta 1.0 w / Fixture Adapter
Testing Ember Data Beta 1.0 Fixture Adapter
by jdcravens
HTML
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
<script src="http://builds.emberjs.com/canary/ember-data.js"></script>
<script type="text/x-handlebars" data-template-name="application">
<h1>ember-latest jsfiddle</h1>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="index">
<h2>Index Content:</h2>
<ul>
{{#each}}
<li>{{name}}</li>
{{/each}}
</ul>
</script>
JavaScript
App = Ember.Application.create({});
App.IndexRoute = Ember.Route.extend({
model: function() {
return this.store.find('timesheet');
}
});
App.TimesheetAdapter = DS.FixtureAdapter.extend({});
App.Timesheet = DS.Model.extend({
name: DS.attr('string'),
colors: DS.attr('string')
});
App.Timesheet.FIXTURES = [
{
id: 1,
name: 'Celtics',
colors: 'Green, White'
}, {
id: 2,
name: 'Lakers',
colors: 'Yellow, Black'
}, {
id: 3,
name: 'Bulls',
colors: 'Red, Black'
}, {
id: 4,
name: 'Mavericks',
colors: 'Blue, White'
}, {
id: 5,
name: 'Spurs',
colors: 'Black, Grey, White'
}
];