|
Belongs to an array of records, storing those locally. The original `belongs_to` associations define a `SingularAssociation`, which means that it could be extended with `array: true`. In this case, I decided to create my own `CollectionAssociation` called `belongs_to_many`, which behaves similar to the single one, but storing and returning a list of records. This was only possible due to PostgreSQL arrays and the new [Arel](https://github.com/crashtech/torque-postgresql/wiki/Arel) inflix operators.
|
|
Belongs to an array of records, storing those locally. The original `belongs_to` associations define a `SingularAssociation`, which means that it could be extended with `array: true`. In this case, I decided to create my own `CollectionAssociation` called `belongs_to_many`, which behaves similar to the single one, but storing and returning a list of records. This was only possible due to PostgreSQL arrays and the new [Arel](https://github.com/crashtech/torque-postgresql/wiki/Arel) inflix operators.
|
|
With this, now you can say things like `Project belongs to many employees`, which
|
|
With this, now you can say things like `Project belongs to many employees`, which is more syntactically correct than `Project has many employees` [PostgreSQL Docs](https://www.postgresql.org/docs/9.6/arrays.html)
|