Add relation between blog and authors

This commit is contained in:
Bat 2018-04-23 12:28:03 +01:00
parent 68db4a82cf
commit 474f063542
1 changed files with 2 additions and 2 deletions

View File

@ -23,14 +23,14 @@ impl BlogAuthor {
diesel::insert_into(blog_authors::table)
.values(new)
.get_result(conn)
.expect("Error saving new blog")
.expect("Error saving new blog author")
}
pub fn get(conn: &PgConnection, id: i32) -> Option<BlogAuthor> {
blog_authors::table.filter(blog_authors::id.eq(id))
.limit(1)
.load::<BlogAuthor>(conn)
.expect("Error loading blog by id")
.expect("Error loading blog author by id")
.into_iter().nth(0)
}
}