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

Run after_save and after_commit even if no changes were made #612

Merged
merged 3 commits into from
Jan 15, 2021
Merged

Run after_save and after_commit even if no changes were made #612

merged 3 commits into from
Jan 15, 2021

Conversation

akadusei
Copy link
Contributor

@akadusei akadusei commented Jan 14, 2021

Closes #604

This PR ensures all nested operations called in after_save run, at all times, and in a transaction. It is, therefore, automatically rolled back if something goes wrong. Other potential benefits are discussed in the linked issue.

With this, we no longer need #600 for completing #596.

This makes after_completed redundant, and is now removed.
Copy link
Member

@matthewmcgarvey matthewmcgarvey left a comment

Choose a reason for hiding this comment

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

I think this is a really good change 👍

Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

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

I think this is the best option. Great work on this! Just a few small changes, and we can get this merged in!

src/avram/callbacks.cr Outdated Show resolved Hide resolved
src/avram/callbacks.cr Outdated Show resolved Hide resolved
src/avram/save_operation.cr Show resolved Hide resolved
src/avram/save_operation.cr Outdated Show resolved Hide resolved
Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you 🎉

@jwoertink jwoertink merged commit 7889210 into luckyframework:master Jan 15, 2021
@akadusei akadusei deleted the feature/always-run-callbacks branch January 16, 2021 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the trip to the database always in save operations
3 participants