Permalink
Browse files

Update generators and examples to use the .first method instead of th…

…e old .load one
  • Loading branch information...
1 parent ca9fb97 commit 4712719a2c9821bc68ec8b6df704a846906280db @larzconwell larzconwell committed Oct 23, 2012
@@ -39,7 +39,7 @@ var Todos = function () {
this.edit = function (req, resp, params) {
var self = this;
- geddy.model.Todo.load(params.id, function(err, todo){
+ geddy.model.Todo.first(params.id, function(err, todo){
self.respond({params: params, todo: todo});
});
};
@@ -24,17 +24,17 @@ class Todos
show: (req, resp, params) ->
self = this
- geddy.model.Todo.load params.id, (err, todo) ->
+ geddy.model.Todo.first params.id, (err, todo) ->
self.respond params: params, todo: todo
edit: (req, resp, params) ->
self = this
- geddy.model.Todo.load params.id, (err, todo) ->
+ geddy.model.Todo.first params.id, (err, todo) ->
self.respond params: params, todo: todo
update: (req, resp, params) ->
self = this
- geddy.model.Todo.load params.id, (err, todo) ->
+ geddy.model.Todo.first params.id, (err, todo) ->
todo.updateAttributes params
todo.save (err, data) ->
@@ -36,23 +36,23 @@ var <%= names.constructor.plural %> = function () {
this.show = function (req, resp, params) {
var self = this;
- geddy.model.<%= names.constructor.singular %>.load(params.id, function(err, <%= names.property.singular %>) {
+ geddy.model.<%= names.constructor.singular %>.first(params.id, function(err, <%= names.property.singular %>) {
self.respond({params: params, <%= names.property.singular %>: <%= names.property.singular %>.toObj()});
});
};
this.edit = function (req, resp, params) {
var self = this;
- geddy.model.<%= names.constructor.singular %>.load(params.id, function(err, <%= names.property.singular %>) {
+ geddy.model.<%= names.constructor.singular %>.first(params.id, function(err, <%= names.property.singular %>) {
self.respond({params: params, <%= names.property.singular %>: <%= names.property.singular %>});
});
};
this.update = function (req, resp, params) {
var self = this;
- geddy.model.<%= names.constructor.singular %>.load(params.id, function(err, <%= names.property.singular %>) {
+ geddy.model.<%= names.constructor.singular %>.first(params.id, function(err, <%= names.property.singular %>) {
<%= names.property.singular %>.updateAttributes(params);
<%= names.property.singular %>.save(function(err, data) {

0 comments on commit 4712719

Please sign in to comment.