Skip to content

Instantly share code, notes, and snippets.

@imsickofmaps
Created December 5, 2013 12:19
Show Gist options
  • Select an option

  • Save imsickofmaps/7804342 to your computer and use it in GitHub Desktop.

Select an option

Save imsickofmaps/7804342 to your computer and use it in GitHub Desktop.
self.get_farmer = function(username) {
var p = self.api_call("farmer/", {
actor__user__username: username
});
p.add_callback(function(result){
return im.log(result);
});
p.add_callback(function(result){
if (result.objects.length === 0){
return null;
} else {
return result.objects[0];
}
});
return p;
};
@hodgestar
Copy link
Copy Markdown

Lines 5-6 do completely the wrong thing. im.log() returns the result of logging -- i.e. whether logging succeeded or not. You want to pass the original result on.

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