-
Notifications
You must be signed in to change notification settings - Fork 125
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
Handle ActiveRecord::Locking::LockingType #2014
base: main
Are you sure you want to change the base?
Handle ActiveRecord::Locking::LockingType #2014
Conversation
I have signed the CLA! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Kevin, thanks for your first contribution!
Can you please credit @cquinones100 correctly by adding this to the end of your commit description:
Co-authored-by: NAME <[email protected]>
That'll make GitHub properly show you both as authors
There's some unrelated CI failures btw. I'm working through those now. |
507f1ab
to
2d5e3c4
Compare
@amomchilov Thanks for the feedback and the guidance, I have accepted all of your edits and updated the co-authors. |
@kbruccoleri Excellent! I'll follow up on this once I've sorted out the CI issues In the meantime, you please fix the lint failure? My hand-scribbled indentation suggestions were incorrect haha. bundle exec rubocop --auto-correct lib/tapioca/dsl/helpers/active_record_column_type_helper.rb |
Hi @kbruccoleri! You can rebase on main, which should fix the CI issues. If you could also fix the linting issues, that would be much appreciated! |
ActiveRecord::Locking::LockingType is used for the lock_version column to handle Optimistic Locking: https://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html - This type was falling into the else block and causing a Sorbet Error: Expected type ::Object, got type ActiveRecord::Locking::LockingType with value #<ActiveModel::Type::Intege...ange=-2147483648...2147483648> (SorbetError) The column_type is really just a wrapper for a potentially nilable integer, so we make a specific exception for it. Co-authored-by: Carlos Quinones <[email protected]> Co-authored-by: Alexander Momchilov <[email protected]>
436a670
to
46688aa
Compare
@egiurleo Thanks for flagging - I believe I am rebased on main now and have |
Motivation
ActiveRecord::Locking::LockingType
is used for thelock_version
column to handle Optimistic Locking:https://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
This type was falling into the else block and causing a Sorbet Error:
Expected type ::Object, got type ActiveRecord::Locking::LockingType with value #<ActiveModel::Type::Intege...ange=-2147483648...2147483648> (SorbetError)
Experiencing an issue after upgrading to latest Tapioca for Rails 7.2 compatibility.
Implementation
The
column_type
is really just a wrapper for a potentially nilable integer, so we make a specific exception for it.Tried to follow the convention around it with regards to determining if particular column is nilable or not.
Tests
No existing test file for
lib/tapioca/dsl/helpers/active_record_column_type_helper.rb
Shoutout to @cquinones100 for co-authoring