Error finding relation in Hanami 2.1 app with custom ROM provider

We are using Dockerfile and docker compose on github repo

git@github.com:alectrico-pro/bookshelf.git

Steps to reproduce issue:

  1. Fork the repository at git@github.com:alectrico-pro/bookshelf.git
  2. Clone on your environment
  3. make build
  4. docker compose up db_test
  5. docker compose up test
  6. docker compose exec test hanami console
    bookshelf[test]> Hanami.app[“persistence.rom”].relations[:books]
    ROM::ElementNotFoundError: :books doesn’t exist in ROM::RelationRegistry registry
    from /usr/local/bundle/gems/rom-core-5.3.2/lib/rom/registry.rb:91:in `block in fetch’
    bookshelf[test]>

I can’t follow your Docker set up, but I guess that’s happening because you haven’t created and/or migrated the database yet.

Can you share what guide you’re following?

I haven’t looked too closely, but this directory stands out to me:

bookshelf/lib/bookshelf/persistence/relation

I think you probably want to rename this directory from “relation” to “relations” (n.b. pluralised name). ROM auto-registration (which I note you’re using inside your :persistence provider) looks for a “relations” dir specifically.