Support after_commit callbacks in transactional fixtures#18458
Merged
Conversation
Member
|
Good job buddy! |
Member
|
Interested to see what @jeremy things about this. |
5d18103 to
1087078
Compare
after_commit callbacks run after committing a transaction whose parent is not `joinable?`: un-nested transactions, transactions within test cases, and transactions in `console --sandbox`.
1087078 to
eb72e34
Compare
jeremy
added a commit
that referenced
this pull request
Jan 20, 2015
Support after_commit callbacks in transactional fixtures
Member
|
Great simplification! 🤘 |
|
👍 |
christopherstyles
added a commit
to code-corps/deprecated-code-corps-rails-api
that referenced
this pull request
Jun 23, 2016
A project should be able to return the number of open posts as well as the number of closed posts. This update adds two counter caches to the project model: `open_posts_count` and `closed_posts_count`. These new attributes reflect the count of posts matching the statuses of their namesake. The [`test_after_commit`](https://github.com/grosser/test_after_commit) gem is needed, as transactional fixtures are enabled and counter caches are updated in an `after_commit` callback. See [magnusvk/counter_culture#a-note-on-testing](https://github.com/magnusvk /counter_culture#a-note-on-testing) for more info. This will no longer be needed in Rails 5: [rails/rails/pull/18458](rails/rails#18458). To update existing counters, run the following: ```ruby Post.counter_culture_fix_counts # https://github.com/magnusvk/counter_culture#manually-populating-counter- cache-values ``` Resolves #323
joshsmith
pushed a commit
to code-corps/deprecated-code-corps-rails-api
that referenced
this pull request
Jun 23, 2016
A project should be able to return the number of open posts as well as the number of closed posts. This update adds two counter caches to the project model: `open_posts_count` and `closed_posts_count`. These new attributes reflect the count of posts matching the statuses of their namesake. The [`test_after_commit`](https://github.com/grosser/test_after_commit) gem is needed, as transactional fixtures are enabled and counter caches are updated in an `after_commit` callback. See [magnusvk/counter_culture#a-note-on-testing](https://github.com/magnusvk /counter_culture#a-note-on-testing) for more info. This will no longer be needed in Rails 5: [rails/rails/pull/18458](rails/rails#18458). To update existing counters, run the following: ```ruby Post.counter_culture_fix_counts https://github.com/magnusvk/counter_culture#manually-populating-counter- cache-values ``` Resolves #323 Ignore localhost Enable elasticsearch on circleci
This was referenced Feb 17, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continuation of #18415
Sorry, I've accidentally amended to a wrong commit. And then github wouldn't pickup any changes 😭
Had to create a new one.
This is a result of discussions with @arthurnn and @matthewd
There is a question whether it's possible to merge
:joinableand:top_levelsettings, but it can be discussed in a different request.cc @jeremy