public
Created

Censo2010 Backbone Rewrite

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 
window.Censo2010 = {};
 
$(function(){
 
Censo2010.CabecerasCollection = Backbone.Collection.extend({
model: Censo2010.Cabecera,
url: function() {
return 'http://censo2010.heroku.com/cabeceras';
}
});
 
});
 
 
$(function(){
 
Censo2010.Cabecera = Backbone.Model.extend({
});
 
});
 
 
Censo2010.Cabeceras = new CabecerasCollection;
 
Censo2010.Cabeceras.fetch({success: function() {alert('bazinga');} })

window.Censo2010 = {}

$ ->
window.Censo2010.BASE = 'http://localhost:9292/'
# window.BASE = 'http://censo2010.heroku.com/'

window.Censo2010.Provincia = Backbone.Model.extend {
}

window.Censo2010.ProvinciaCollection = Backbone.Collection.extend {
url: ->
Censo2010.BASE + 'provincias'
}

window.Censo2010.Provincias = new Censo2010.ProvinciaCollection

Censo2010.Provincias.fetch {
success: -> alert 'bazinga'
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.