Skip to content

Have things working and tests passing on ActiveRecord 5.2 #64

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

Merged
merged 8 commits into from
Aug 21, 2019

Conversation

jrochkind
Copy link
Collaborator

@jrochkind jrochkind commented Aug 21, 2019

Closes #60

In AR 5.1 find_or_create_by and new_record_before_save? interact differently, to break the original code. (I think maybe it was relying on a bug in new_record_before_save?, I don't really understand what new_record_before_save? is).

I believe this is the same logic, rewritten more clearly and in a way that will work in Rails 5.1.

Note that find_or_create_by is NOT atomic, in any Rails version. So we should not have introduced any race condition that wasn't there already, we're still creating by soon after find if not present, just a slight intervening check for token.last == 0, shoudn't be much racier than before.
I don't know if there's a reason for us to test ruby 2.2 at all, but we are.
@jrochkind jrochkind merged commit 5cf2baa into master Aug 21, 2019
@jrochkind jrochkind deleted the update_tested_active_record branch August 21, 2019 18:45
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.

tests only on Rails 4.0.x
1 participant