Using sets for many-to-many relationships

Updated . Posted . Visible to the public.

A technique to vastly reduce the number of join model records that need to be stored in the database.

The technique is only effective when there is a high redundancy in your data, e.g. combinations of the same 20 tags are used to label thousands of books.

The technique is also limited in that your join models cannot have additional logic, such as attributes or callbacks.

Ther has-many-with-set gem Show archive.org snapshot is an implementation of this technique.

Henning Koch
Last edit
Keywords
has_many
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2012-11-14 19:30)