aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2017-11-21 23:19:05 +0100
committerHarald Eilertsen <haraldei@anduin.net>2017-11-21 23:19:05 +0100
commitbeede75cefd5ae52c2d81b7f183cfa41953b09a4 (patch)
treec2ff6e0a2f98083474ac7856f48413ce07820fae
parentf6b3c1a3a1fd1eddeb7e87262d56ae9dbdb47ac1 (diff)
downloadrocket-blog-beede75cefd5ae52c2d81b7f183cfa41953b09a4.tar.gz
rocket-blog-beede75cefd5ae52c2d81b7f183cfa41953b09a4.tar.bz2
rocket-blog-beede75cefd5ae52c2d81b7f183cfa41953b09a4.zip
Derive FromForm for models::Post.
This allows us to pass in forms that will translate into proper form objects.
-rw-r--r--src/lib.rs3
-rw-r--r--src/models.rs2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 097dc66..c950e7a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,6 @@
+#![feature(plugin, custom_derive)]
+#![plugin(rocket_codegen)]
+
#[macro_use]
extern crate diesel_codegen;
pub mod models;
diff --git a/src/models.rs b/src/models.rs
index a0152c0..d8aa0aa 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -1,4 +1,4 @@
-#[derive(Default, Serialize, Queryable)]
+#[derive(Debug, Default, FromForm, Serialize, Queryable)]
pub struct Post {
pub id: i32,
pub title: String,