-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Support after_commit callbacks in transactional fixtures #18458
Merged
Merged
Conversation
This file contains 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
Good job buddy! |
Interested to see what @jeremy things about this. |
brainopia
force-pushed
the
fix_after_commit_for_fixtures
branch
4 times, most recently
from
January 16, 2015 00:19
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`.
brainopia
force-pushed
the
fix_after_commit_for_fixtures
branch
from
January 16, 2015 00:52
1087078
to
eb72e34
Compare
jeremy
added a commit
that referenced
this pull request
Jan 20, 2015
Support after_commit callbacks in transactional fixtures
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
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Sep 18, 2018
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Oct 5, 2018
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Jan 10, 2019
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Jan 29, 2019
lizconlan
added a commit
to mysociety/alaveteli
that referenced
this pull request
Feb 27, 2019
In addition to our call to InfoRequest.find() with a string (from params) in the controller, Rails 5 calls after_commit callbacks in tests: rails/rails#18458 For InfoRequest, this results in additional calls to find() with an integer (or an array thereof) which breaks our tests unless we unstub the general case for find(), allowing it to call the original method. The change in this commit avoids raising the error:
lizconlan
added a commit
to mysociety/alaveteli
that referenced
this pull request
Apr 2, 2019
In addition to our call to InfoRequest.find() with a string (from params) in the controller, Rails 5 calls after_commit callbacks in tests: rails/rails#18458 For InfoRequest, this results in additional calls to find() with an integer (or an array thereof) which breaks our tests unless we unstub the general case for find(), allowing it to call the original method. The change in this commit avoids raising the error:
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Oct 2, 2019
duduribeiro
pushed a commit
to 3scale/porta
that referenced
this pull request
Nov 8, 2019
duduribeiro
pushed a commit
to 3scale/porta
that referenced
this pull request
Nov 18, 2019
duduribeiro
pushed a commit
to 3scale/porta
that referenced
this pull request
Dec 12, 2019
duduribeiro
pushed a commit
to 3scale/porta
that referenced
this pull request
Dec 26, 2019
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Jan 23, 2020
duduribeiro
pushed a commit
to 3scale/porta
that referenced
this pull request
Jan 31, 2020
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Feb 4, 2020
hallelujah
added a commit
to 3scale/porta
that referenced
this pull request
Feb 10, 2020
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
:joinable
and:top_level
settings, but it can be discussed in a different request.cc @jeremy