diff options
author | Melody Horn / boringcactus <melody@boringcactus.com> | 2021-06-18 10:12:16 -0600 |
---|---|---|
committer | Melody Horn / boringcactus <melody@boringcactus.com> | 2021-06-18 10:12:16 -0600 |
commit | 709eb44ccb8d08ad7f26cdac2932eadc7ccd48e7 (patch) | |
tree | cc4aa6854147c0dc74bbd3bea9b8b9cfc083b62f /examples | |
parent | 3b880c0ae7963d783fb87a3389f98070e448495a (diff) | |
download | tosin-709eb44ccb8d08ad7f26cdac2932eadc7ccd48e7.tar.gz tosin-709eb44ccb8d08ad7f26cdac2932eadc7ccd48e7.zip |
make model metadata available in AppConfig
Diffstat (limited to 'examples')
-rw-r--r-- | examples/tutorial01/polls/mod.rs | 2 | ||||
-rw-r--r-- | examples/tutorial01/polls/models.rs | 5 | ||||
-rw-r--r-- | examples/tutorial02/polls/mod.rs | 1 | ||||
-rw-r--r-- | examples/tutorial02/polls/models.rs | 4 |
4 files changed, 10 insertions, 2 deletions
diff --git a/examples/tutorial01/polls/mod.rs b/examples/tutorial01/polls/mod.rs index 0b039d9..d15a1ca 100644 --- a/examples/tutorial01/polls/mod.rs +++ b/examples/tutorial01/polls/mod.rs @@ -7,7 +7,9 @@ pub mod views; pub use urls::urls; +#[allow(dead_code)] pub const APP: AppConfig = AppConfig { name: module_path!(), + models: models::ALL, migrations: migrations::migrations, }; diff --git a/examples/tutorial01/polls/models.rs b/examples/tutorial01/polls/models.rs index 82aa7fd..bc1cd9b 100644 --- a/examples/tutorial01/polls/models.rs +++ b/examples/tutorial01/polls/models.rs @@ -1,3 +1,6 @@ -use tosin::db::models::{Model, Id}; +#[allow(unused_imports)] +use tosin::db::models::{Model, Id, gather}; // TODO define models + +gather!(); diff --git a/examples/tutorial02/polls/mod.rs b/examples/tutorial02/polls/mod.rs index 0b039d9..1968d5a 100644 --- a/examples/tutorial02/polls/mod.rs +++ b/examples/tutorial02/polls/mod.rs @@ -9,5 +9,6 @@ pub use urls::urls; pub const APP: AppConfig = AppConfig { name: module_path!(), + models: models::ALL, migrations: migrations::migrations, }; diff --git a/examples/tutorial02/polls/models.rs b/examples/tutorial02/polls/models.rs index 5ed52c5..fb8be8f 100644 --- a/examples/tutorial02/polls/models.rs +++ b/examples/tutorial02/polls/models.rs @@ -1,4 +1,4 @@ -use tosin::db::models::{Model, Id}; +use tosin::db::models::{Model, Id, gather}; #[derive(Model)] pub struct Question { @@ -19,3 +19,5 @@ pub struct Choice { #[model(default = 0)] votes: usize, } + +gather!(); |