Shopify / tapioca

The swiss army knife of RBI generation
MIT License
728 stars 121 forks source link

Fix ActiveRecordRelations compiler to dedup #all #1942

Closed bitwise-aiden closed 3 months ago

bitwise-aiden commented 3 months ago

Motivation

Rails head has been updated to include #all under ActiveRecord::QueryMethods (source).

Implementation

I had tried to update the QUERY_METHODS constant to remove the intersection with ActiveRecord::AssociationRelation.instance_methods as that is where all is originally coming from, but this was over zealous causing a bunch of errors.

The option I've gone with is to update the ones removed as "private api" since they overlap with what is done in Rails: https://github.com/Shopify/tapioca/blob/d652d570b0d73aca16edb2927163f369c3dddeba/lib/tapioca/dsl/compilers/active_record_relations.rb#L194

Tests

Tested against rails head.