Skip to content
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

Noop when update without providing any values #1384

Merged
merged 8 commits into from
Jan 26, 2023
Merged

Conversation

billy1624
Copy link
Member

@billy1624 billy1624 commented Jan 10, 2023

PR Info

Bug Fixes

  • When updating / saving an existing ActiveModel with all its value being Unchanged or NotSet, the expected behaviour should be no-op. That's to skip firing any update statement.

@billy1624 billy1624 marked this pull request as ready for review January 12, 2023 09:20
@billy1624 billy1624 requested a review from tyt2y3 January 12, 2023 09:36
Cargo.toml Outdated Show resolved Hide resolved
@billy1624 billy1624 requested a review from tyt2y3 January 26, 2023 08:27
@tyt2y3 tyt2y3 merged commit 036edf9 into master Jan 26, 2023
@tyt2y3 tyt2y3 deleted the update-with-noop branch January 26, 2023 09:12
@@ -1423,8 +1423,8 @@ mod tests {
vec![
Transaction::from_sql_and_values(
DbBackend::Postgres,
r#"UPDATE "fruit" SET WHERE "fruit"."id" = $1 RETURNING "id", "name", "cake_id""#,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know we put such a test case here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. That's bad :(

Copy link
Member Author

@billy1624 billy1624 Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a red flag that sit there silently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Syntax Error when saving active model that sets nothing
2 participants