aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/post.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/post.rs')
-rw-r--r--src/models/post.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/models/post.rs b/src/models/post.rs
index 3dd0879..17ac74a 100644
--- a/src/models/post.rs
+++ b/src/models/post.rs
@@ -1,6 +1,6 @@
use schema::posts;
use diesel::prelude::*;
-use diesel::{self, ExecuteDsl};
+use diesel;
use utils;
#[derive(AsChangeset, FromForm, Identifiable, Serialize, Queryable)]
@@ -40,8 +40,9 @@ impl Post {
}
pub fn create(new_post: &NewPost, conn: utils::DbConn) {
- diesel::insert(new_post)
- .into(posts::table)
+ use ::schema::posts::dsl::*;
+ diesel::insert_into(posts)
+ .values(new_post)
.execute(&*conn)
.expect("Error saving post.");
}