Handle ActiveRecord::Locking::LockingType
Motivation
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)
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
I have signed the CLA!
There's some unrelated CI failures btw. I'm working through those now.
@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!
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!
@egiurleo Thanks for flagging - I believe I am rebased on main now and have bin/style passing.
Hi there! Is there anything I can do to get this over the finish line? It seems like some checks might be failing for other reasons.
@kbruccoleri I don't know what was up with those CI failures. I rebased, fixed the merge conflict, and started another CI run. I'll have a look at its result in the morning.