diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-01-18 20:11:07 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-01-18 20:11:07 +0100 |
commit | 337c9d2b2280f8e252e8c9acd7e73caf1291d7a5 (patch) | |
tree | 9468fa1820970e846ef4868f0ec2dba655b81679 /src/models | |
parent | e96c58580b2ac1874718f3d31a1d4abcdcc6dbb6 (diff) | |
download | rocket-blog-337c9d2b2280f8e252e8c9acd7e73caf1291d7a5.tar.gz rocket-blog-337c9d2b2280f8e252e8c9acd7e73caf1291d7a5.tar.bz2 rocket-blog-337c9d2b2280f8e252e8c9acd7e73caf1291d7a5.zip |
Upgrade to Diesel 1.1 and r2d2 0.8.2.
Also drop the now obsolete diesel_codegen crate.
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/post.rs | 7 |
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."); } |