tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Remove polymorphic check when generating associating methods

Open matthewarkin opened this issue 1 year ago • 1 comments

Motivation

We noticed when adding some typing to our code that association methods for polymorphic associations were returning a generic ActiveRecord::Associations::CollectionProxy instead of the Model::PrivateCollectionProxy that is used elsewhere in tapioca.

Implementation

I believe checking for the polymorphicness of the association is actually unnecessary since it shouldn't ever be the case that the association for a has_many would return a collection of different types.

Tests

I updated the existing tests to reflect the updated behavior. I don't think I'm missing a test case but thats mostly because I can't think of a case where you woudn't be able to pin the method to a specific model/type.

matthewarkin avatar Aug 14 '24 18:08 matthewarkin

I have signed the CLA!

matthewarkin avatar Aug 28 '24 21:08 matthewarkin