You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
Just trying out Sorbet and this gem for the first time, so maybe there's a way to handle this already?
I have an ActiveRecord class that uses serialize field_name, Hash and the rake rails_rbi:models command has generated an rbi file where both the getter and setter methods for field_name are down as using the datatype T.nilable(String), which is the datatype of the underlying database field, rather than referencing Hash which is what those methods use thanks to serialize.
I've edited the generated rbi file for now, but wondered if there's a sig or something I should be writing on the class to make this work already? Or maybe this is a feature request for the gem?
The text was updated successfully, but these errors were encountered:
Hi @DMA57361. We are mainly based on Database type, but we'll look into support for serialize and custom types. Meanwhile, you can actually override the generated RBI instead of editing the file directly.
If you add your own model.rbi and redefine the methods with correct types, Sorbet should pick up the correct type.
Just trying out Sorbet and this gem for the first time, so maybe there's a way to handle this already?
I have an ActiveRecord class that uses
serialize field_name, Hash
and therake rails_rbi:models
command has generated an rbi file where both the getter and setter methods for field_name are down as using the datatypeT.nilable(String)
, which is the datatype of the underlying database field, rather than referencing Hash which is what those methods use thanks to serialize.I've edited the generated rbi file for now, but wondered if there's a sig or something I should be writing on the class to make this work already? Or maybe this is a feature request for the gem?
The text was updated successfully, but these errors were encountered: