Skip to content

Instantly share code, notes, and snippets.

@jwhitehorn
Created April 30, 2018 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwhitehorn/32929cfa01d183485a80b26938239bea to your computer and use it in GitHub Desktop.
Save jwhitehorn/32929cfa01d183485a80b26938239bea to your computer and use it in GitHub Desktop.
var CampgroundReview = db.define("campground_reviews", {
headline: String,
body: String,
rating: Number,
campground_id: Number,
updated_at: Date
}, {
hooks: {
beforeSave: function(next){
this.updated_at = new Date();
next();
},
beforeRemove: function(next){
var details = {
record_id: this.id,
table_name: "campground_reviews"
}
DeletedRecord.create(details, next);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment