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

#[changeset_for(table_name)] only implements save_changes if there is a field called id on the struct #354

Closed
weiznich opened this Issue Jun 14, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@weiznich
Contributor

weiznich commented Jun 14, 2016

The documentation states that save_changes is implemented if the struct contains a field called like the primary key:

If the struct has a field for the primary key, an additional function, save_changes<T: Queryable<..>>(&self, connection: &Connection) -> QueryResult, will be added to the model. This will persist any changes made, and return the resulting record. It is intended to be a shorthand for filtering by the primary key.

Codegen implements save_changes only if there is a field called id. Either we should fix the documentation or we add support for custom primary keys here.

@sgrif

This comment has been minimized.

Member

sgrif commented Jun 14, 2016

This is fixed in 0.7

@sgrif sgrif closed this Jun 14, 2016

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