Skip to content

Instantly share code, notes, and snippets.

@etagwerker
Created June 18, 2011 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etagwerker/1033187 to your computer and use it in GitHub Desktop.
Save etagwerker/1033187 to your computer and use it in GitHub Desktop.
Censo2010 Backbone Rewrite
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');} })
@lucasefe
Copy link

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'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment