# Prevent after\_commit triggering on Postgres savepoints

**URL:** <https://discuss.rubyonrails.org/t/prevent-after-commit-triggering-on-postgres-savepoints/78093>\
**Category:** rubyonrails-core\
**Tags:** activerecord\
**Created:** [May 29, 2021, 2:15pm UTC](https://discuss.rubyonrails.org/t/prevent-after-commit-triggering-on-postgres-savepoints/78093 "2021-05-29T14:15:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maschwenk](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/maschwenk/32/2182_2.png) [@maschwenk](https://discuss.rubyonrails.org/u/maschwenk)\
**Post date:** [May 29, 2021, 2:15pm UTC](https://discuss.rubyonrails.org/t/prevent-after-commit-triggering-on-postgres-savepoints/78093/1 "2021-05-29T14:15:55Z")

</div>

Is there any way to prevent `after_commit` hooks triggering on Postgres savepoints?

I can see some situations where savepoints may want to be treated as “commits” but in our case it’s harmful because we explicitly want to make sure the hook is only firing after a non simulated transaction.

Happy to open a PR if the functionality does not exist and is possible to implement.

---

<div class="post-metadata">

**Author:** ![zzak](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/zzak/32/9116_2.png) [@zzak](https://discuss.rubyonrails.org/u/zzak)\
**Post date:** [May 30, 2021, 12:02am UTC](https://discuss.rubyonrails.org/t/prevent-after-commit-triggering-on-postgres-savepoints/78093/2 "2021-05-30T00:02:39Z")

</div>

@maschwenk Could you explain your use-case a little more? I’m not sure I understand what you’re trying to do.

Afaict there is no way to skip these callbacks, but you could wrap them in a [transaction](https://api.rubyonrails.org/v6.1.3.2/classes/ActiveRecord/Transactions/ClassMethods.html) and use that as a signal to trigger other hooks.
