Hey Everyone.
Last year I implemented array association on my GEM exclusively for PostgreSQL:
I'm planning to push this feature to Active Record, so any database that supports array could use.
The main steps that I took was:
1. Allow `array` setting for `has_many`
2. Identify array associations with something like `connected_through_array?`
3. Create a generic method that infers the correct way to connect both keys (primary_key and foreign_key), instead of direct use of `table[key].eq(foreign_table[foreign_key]`
4. Allow `cast` to be called on Some Arel Nodes
5. Make sure that `AssociationScope` rely on the above generic method to build the condition
6. Create the correct `BindParam` for each value on an array association
7. Create the necessary `BelongsToManyReflection`, `BelongsToManyAssociation`, and `Builder::BelongsToMany`
8. Adjust `AutosaveAssociation` to behave properly against array associations
9. A couple of other minors adjusts to make it seamless to other associations
The only problem so far is that it doesn't work with Polymorphic, but, it's so far a big win, especially for systems with `tags` and `conversations` (with multiple users).
I want to hear people's opinions. And, if I decided to move forward, I'll do one step at a time, probably starting by the generic method on step #3.