action to create a confession

angular
Matt Huntington 10 years ago
parent 21753eeb9a
commit 164724c90e

@ -65,8 +65,15 @@ app.controller('TransgressionsController', ['$http', function($http){
} }
this.createConfession = function(transgression_id){ this.createConfession = function(transgression_id){
console.log(this); $http.post('/transgressions/'+transgression_id+'/confessions', {
console.log(this.newConfessionDescription); //include authenticity_token
console.log(this.newConfessionDate); authenticity_token: authenticity_token,
confession: {
description: this.newConfessionDescription,
occurred_at: this.newConfessionDate
}
}).success(function(data){
console.log(data)
});
} }
}]); }]);

Loading…
Cancel
Save