Skip to content

Commit

Permalink
Fix type of column_type parameter for handle_unknown_type method
Browse files Browse the repository at this point in the history
The passed value of `column_type` parameter is not necessarily always
an `Object`. For example, `ActiveSupport::Types::Serialized` does not
have `Object` as an ancestor, since it is defined as:
```
class Serialized < DelegateClass(ActiveModel::Type::Value)
```
which makes it subclass from `BasicObject`.

We were using `Object` as the type for `column_type` parameter, but we
really wanted to use `BasicObject` instead.

I added a serialized column to a test case to see this fail before the
change and pass after the change.
  • Loading branch information
paracycle committed Jun 16, 2022
1 parent 9f2d26a commit 8bebf09
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def as_nilable_type(type)
end
end

sig { params(column_type: Object).returns(String) }
sig { params(column_type: BasicObject).returns(String) }
def handle_unknown_type(column_type)
return "T.untyped" unless ActiveModel::Type::Value === column_type
return "T.untyped" if Runtime::GenericTypeRegistry.generic_type_instance?(column_type)
Expand Down

0 comments on commit 8bebf09

Please sign in to comment.