rustc 1.23.0-beta.2 (c9107ee93 2017-12-08)trying to follow the association documentation https://docs.diesel.rs/diesel/associations/index.html and get a compilation error
no build errors
Compiling association_error v0.1.0 (file:///home/qmx/tmp/association_error)
error[E0433]: failed to resolve. Use of undeclared type or module `payees`
--> src/lib.rs:13:17
|
13 | #[derive(Debug, Identifiable)]
| ^^^^^^^^^^^^ Use of undeclared type or module `payees`
|
= note: this error originates in a macro outside of the current crate
error: aborting due to 2 previous errors
error: Could not compile `association_error`.
To learn more, run the command again with --verbose.
fully reproduceable repo here https://github.com/qmx/diesel-association-error-repro
You need to ensure that your payees module is in scope, with a line such as use schema::payees; (Assuming that you have your table! or infer_schema! declarations in a module called schema).
good call, any suggestion on how to make this more obvious at the docs? Happy to put a PR together, as I've read it a handful times and couldn't see.
We mention this in a few other places (I think the associations docs mentions it?) we could probably put that same wording in the docs for Identifiable.
Most helpful comment
You need to ensure that your
payeesmodule is in scope, with a line such asuse schema::payees;(Assuming that you have yourtable!orinfer_schema!declarations in a module calledschema).