buildURL override example
Based on latest version of Ember.js with the new router. (latest ember build from 2013-01-06) Also including latest master of Ember Data (2013-01-06)
by adriencoquio
HTML
<script src="https://github.com/downloads/wycats/handlebars.js/handlebars-1.0.rc.1.js"></script>
<script src="https://gist.github.com/raw/4469745/b102ee742d0c014bdb21715525255069d0b828bb/ember-latest-201301062045.js"></script>
<script src="https://gist.github.com/raw/4593534/7ce5e6dfdd909a3f5f58650b5d87d5461369eda3/ember-data.js"></script>
test
JavaScript
App = Ember.Application.create();
App.Post = DS.Model.extend({
title: DS.attr('string'),
user: DS.belongsTo('App.User')
});
// Adapter and store
App.Adapter = DS.RESTAdapter.extend({
buildURL: function(record, suffix) {
return this._super(record,suffix) + '.json'
}
});
App.store = DS.Store.create({
adapter: App.Adapter.create(),
revision: 11
});
posts = App.Post.find(1)