Skip to content

Conversation

@bobcats
Copy link
Contributor

@bobcats bobcats commented Aug 19, 2025

Motivation

I couldn't find an existing issue for this, but I noticed while upgrading from 16 to 17, the ids method was generating as Array[T.untyped] for our UUID primary keys, while other similar UUID returning methods were generating as String

Implementation

I don't know intention behind ActiveModelTypeHelper vs ActiveRecordColumnHelper, but since these are primary keys and tables exist, it seemed fine to use ActiveRecordColumnHelper? That seemed preferable compared to changing ActiveModelTypeHelper at all. Also, there is some other code using the Model Helper for :find and also seems to care about primary keys, but I don't know if that should also use ActiveRecordColumnHelper too.

Tests

I wasn't sure the best way to test this, given it seems pretty postgres specific, but happy to add some! Seems like existing tests are passing fwiw.

Thanks for looking!

@bobcats bobcats requested a review from a team as a code owner August 19, 2025 21:12
Copy link
Contributor

@KaanOzkan KaanOzkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you sign the CLA please? It's a CI check.

primary_key_type = constant.type_for_attribute(constant.primary_key)
type = Tapioca::Dsl::Helpers::ActiveModelTypeHelper.type_for(primary_key_type)
type = RBIHelper.as_non_nilable_type(type)
column_type_helper = Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper.new(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a fine change. For AR helper will refer to AM helper so the support for custom types attribute :id, CustomId.new will still work.

@bobcats
Copy link
Contributor Author

bobcats commented Aug 26, 2025

I have signed the CLA!

@KaanOzkan KaanOzkan merged commit c5e1c24 into Shopify:main Aug 27, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants