As of the current version, Hanami supports associations as an experimental feature only for the SQL adapter.
Because the association is made of data linked together in a database, we define associations in repositories.
When we define an association, the repository doesn’t get any extra public methods.
If we need to create an author, contextually with a few books, we need to explicitly define a method to perform that operation.
If we don’t explicitly load that books, then the resulting data will be .
Please remember that operations on associations are made via explicit repository methods. Hanami does NOT support by design, the following use cases:
- (to try to load on sale books from the database)
author.books << book
(to try to associate a book to the author)- (to try to unassociate the books from the author)