secret
Created

Try to get couchdb adapter running under emberjs.

  • Download Gist
emberjs using couchdb-adapter
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 31 32 33 34 35 36 37 38 39 40 41 42 43
TodoApp = Ember.Application.create({
LOG_TRANSITIONS: true
});
 
TodoApp.CouchDBAdapter = DS.CouchDBAdapter.extend({
db: 'testdb',
designDoc: 'todo',
});
 
TodoApp.Store = DS.Store.extend({
revision: 11,
adapter: TodoApp.CouchDBAdapter,
});
 
TodoApp.Todo = DS.Model.extend({
type: DS.attr('string'),
title: DS.attr('string'),
content: DS.attr('string'),
creator: DS.attr('string'),
created_at: DS.attr('string'),
done: DS.attr('boolean'),
});
 
 
TodoApp.ApplicationController = Ember.Controller.extend({
applicationName: 'Todo List'
});
 
 
TodoApp.Router.map (function() {
this.resource('about');
this.resource('todos');
});
 
TodoApp.TodosRoute = Ember.Route.extend({
model: function() {
return TodoApp.Todo.findQuery(TodoApp.TodoModel, {
type: 'view',
viewName: 'todos',
options: { include_docs: true }
});
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.