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

Not writing to database with auto_increment: true #67

Merged
merged 2 commits into from
Jun 16, 2020
Merged

Not writing to database with auto_increment: true #67

merged 2 commits into from
Jun 16, 2020

Conversation

bartpalmtree
Copy link
Contributor

When using auto_increment it wouldn't save the model. It would continue as persisted and not new_record, but was flagged changed. When I had a different instance of the user the counter would never match, but always be zero.

If I only used the in-memory/cached user object then it would work just fine.
E.g.,
u = User.find(1)
u.otp_counter #=> 0
u.otp_code() #=> "226630"
u.otp_code(auto_increment: true) #=> "279079"
u.otp_counter #=> 1
u = User.find(1)
u.otp_counter #=> 0 (expected 1)

When using auto_increment it wouldn't save the model so when I had a different instance of the user the counter would never match.
@guilleiguaran guilleiguaran merged commit 43684f2 into heapsource:master Jun 16, 2020
@bartpalmtree
Copy link
Contributor Author

Thanks!!

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.

None yet

2 participants