Tag: canjs

can.js如何将记录添加到Rails服务器?

我正在使用Can.js将记录添加到Ruby on Rails服务器: var Todo = can.Model({ findAll : ‘GET /todos’, findOne : ‘GET /todos/{id}’, create : ‘POST /todos’, update : ‘PUT /todos/{id}’, destroy : ‘DELETE /todos/{id}’ }, {}); Todo.prototype.description = function() { return this.name + ” and ” + this.complete; }; Todo.findAll({}, function(todos) { todos.each(function(todo) { console.log(todo.name, todo.complete); console.log(todo.description()); }); }); var todo = […]