Ember Latest

The latest build of Ember.

by Kerrick

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 src="//cdnjs.cloudflare.com/ajax/libs/jquery-mockjax/1.5.3/jquery.mockjax.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>Save this and observe your console.</h2>
    <p>Note the disturbing lack of metadata</p>
    <form {{action "save" on="submit"}}>
        {{input type="text" value=bar placehodler="foo.bar"}}
        <input type="submit" value="save" />
    </form>
</script>

CSS

h1 { font-size: 1.6em; padding-bottom: 10px; }
h2 { font-size: 1.4em; }
ul { padding: 15px; font-size: 1.4em; color: green; }

JavaScript

App = Ember.Application.create({});

App.IndexRoute = Ember.Route.extend({
    model: function(){
        return this.get('store').createRecord('foo');
    },
    actions: {
        save: function() {
            var log = function() {
                console.log('MetaData: ', this.get('store').metadataFor('foo'));
            }.bind(this);
            this.modelFor('index').save().then(log, log);
        }
    }
});

App.Foo = DS.Model.extend({
    bar: DS.attr('string')
});

$.mockjax({
    url: '/foos',
    type: 'POST',
    status: 400, // This works if you change it to 201
    responseText: {
        foo: {
            bar: 'baz'
        },
        meta: {
            test: 'YOU SHOULD SEE THIS'
        }
    }
});