JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.5.2/jquery.mockjax.js"></script>
<script src="http://ember.alexspeller.com/handlebars-1.0.0.js"></script>
<script src="http://ember.alexspeller.com/ember-latest.js"></script>
<script src="http://ember.alexspeller.com/ember-data-latest.js"></script>
<script type="text/x-handlebars">
<h1>Ember Data Mockjax</h1>
{{#link-to 'schedule' 1}}
Schedule 1
{{/link-to}}
<div>
{{outlet}}
</div>
</script>
<script type="text/x-handlebars" data-template-name='schedule'>
<h2>Schedule</h2>
{{name}}
</script>
JavaScript
window.App = Em.Application.create();
App.Store = DS.Store.extend({
adapter: "_ams"
});
App.ApplicationAdapter = DS.ActiveModelAdapter.extend();
App.ApplicationSerializer = DS.ActiveModelSerializer.extend({
primaryKey: '_id',
normalize: function(type, hash, prop) {
this.normalizeMongoidId(hash);
return this._super(type, hash, prop);
},
normalizeMongoidId: function(hash) {
var json;
json = {
id: hash._id
};
return delete hash._id;
}
});
App.Router.map(function() {
this.resource('schedule', {
path: '/schedules/:schedule_id'
});
});
App.Schedule = DS.Model.extend({
name: DS.attr('string')
});
$.mockjax({
url: "/schedules/1",
responseText: {
schedules: [
{
id: 1,
name: "First Schedule"
}
]
}
});