Association not being loaded if foreign key is aliased

Say we have two relations:

class Registrations < ROM::Relation[:sql]
  schema(:registrations, infer: true)

  associations do
    belongs_to :client
class Clients < ROM::Relation[:sql]
  schema(:clients, infer: true)

Doing the following works as expected:


However, if we add the following alias in the Registrations relation to the foreign key attribute:

attribute :cliente_id, Types::Int.optional.meta(alias: :client_id)

Now, combine will always return nil as the client key, even when client_id attribute is populated.

Trying to specify the aliased name as foreign key:

    belongs_to :client, foreign_key: :client_id

fails with:

KeyError: :client_id attribute doesn't exist in registrations schema

While specifying the actual table name in as foreign_key:

    belongs_to :client, foreign_key: :cliente_id

doesn’t solve the issue.

Is there something else expected to be performed on my side or is it a bug?

This is a bug. Please report in rom-rb/rom.