New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom_derive! + HasMany! not working for me #389

Closed
bahlo opened this Issue Aug 1, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@bahlo
Member

bahlo commented Aug 1, 2016

I have a setup similar to your getting started guide and want to add the HasMany! macro with custom_derive.

Crate list in main.rs:

#![feature(custom_derive, custom_attribute, plugin)]
#![plugin(diesel_codegen, dotenv_macros)]

#[macro_use] extern crate diesel;
extern crate dotenv;
#[macro_use] extern crate custom_derive;

My user model:

custom_derive! {
    #[derive(Identifiable, HasMany(items, foreign_key = user_id))]
    #[table_name(users)]
    pub struct User {
        pub id: i32,
        // Other fields
    }
}

Cargo.toml excerpt

diesel = "0.6.2"
diesel_codegen = { version = "0.6.2", default-features = false, features = ["nightly", "postgres"] }
dotenv = "0.8.0"
dotenv_macros = "0.8.0"
custom_derive = "0.1.5"

When I run the code, I get the following output:

   Compiling my-app v0.1.0 (file:///Users/arne/Developer/my-app)
<custom_derive macros>:114:32: 114:33 error: macro undefined: 'Identifiable!'
<custom_derive macros>:114 $ ( $ user_drvs ) * $ new_user (  ) , ) } } ; (
                                                          ^
<custom_derive macros>:120:32: 120:33 error: macro undefined: 'HasMany!'
<custom_derive macros>:120 $ ( $ user_drvs ) * $ new_user ( $ ( $ new_user_args ) * ) , ) } } ; (
                                                          ^
error: aborting due to 2 previous errors
error: Could not compile `my-app`.

To learn more, run the command again with --verbose.

I'm thankful for any help 😊

@killercup

This comment has been minimized.

Member

killercup commented Aug 1, 2016

Thanks for the detailed report!

HasMany! is not available in version 0.6.2, as it was introduced just 2 days ago in #386. The docs are rendered for the master branch. While there should be a new release 0.7 soon, you can track master in the meantime.

@bahlo

This comment has been minimized.

Member

bahlo commented Aug 1, 2016

@killercup: Thanks for your help, didn't think of that. 🙈

@bahlo bahlo closed this Aug 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment