clio / polymorphic_integer_type

MIT License
37 stars 35 forks source link

Fix polymorphic integer lookup rails 5.0 #26

Closed mctaylorpants closed 4 years ago

mctaylorpants commented 4 years ago

The existing patch on PolymorphicArrayValue only handled queries that passed multiple values to a polymorphic type column, for example:

  Link.where(source: [source_1, source_2])

In order to handle passing a single value, we need to patch the AssociationQueryHandler.

This issue only exists in Rails 5.0 and 5.1; it's been fixed in 5.2.

I've also reorganized the version-specific patches into activerecord_ folders to keep things tidy ✨


✅ This PR passes all the specs in Rails 4, 5.0, 5.1 and 5.2.