Skip to content

use primary key type for ActiveRecord::Calculations#ids return type #2271

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ebarajas
Copy link

Motivation

This PR updates the built-in Tapioca::Dsl::Compilers::ActiveRecordRelations compiler to add a narrowed type for the return value of #ids. Before this was simply set to Array, so each item in the array was resolving to T.untyped.

Implementation

I duplicated some existing work done for the #find method to determine the type of the primary key column.

Tests

I've updated the existing test to assert the RBI is generated as expected.

@ebarajas ebarajas requested a review from a team as a code owner May 12, 2025 20:05
@ebarajas
Copy link
Author

I have signed the CLA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants