aboutsummaryrefslogtreecommitdiffstats
path: root/src/controllers
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-01-12 12:16:54 +0100
committerHarald Eilertsen <haraldei@anduin.net>2018-01-12 12:16:54 +0100
commit35112f2357d6510a889c8e20604b11a2c0acf342 (patch)
tree633df7fa174d885925e4445b3e68b164047161ef /src/controllers
parent49a06ccbf087c4ed0db3d61f3ac4892f45858ce1 (diff)
downloadrocket-blog-35112f2357d6510a889c8e20604b11a2c0acf342.tar.gz
rocket-blog-35112f2357d6510a889c8e20604b11a2c0acf342.tar.bz2
rocket-blog-35112f2357d6510a889c8e20604b11a2c0acf342.zip
Implement deleting posts.
Diffstat (limited to 'src/controllers')
-rw-r--r--src/controllers/posts_controller.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/controllers/posts_controller.rs b/src/controllers/posts_controller.rs
index fde08a8..a8c5e1c 100644
--- a/src/controllers/posts_controller.rs
+++ b/src/controllers/posts_controller.rs
@@ -55,3 +55,9 @@ fn update(post: Form<::models::Post>, conn: utils::DbConn) -> Redirect {
::models::Post::update(post.get(), conn);
Redirect::to("/")
}
+
+#[get("/<id>/delete", format = "text/html")]
+fn delete(id: i32, conn: utils::DbConn) -> Redirect {
+ ::models::Post::delete(id, conn);
+ Redirect::to("/")
+}