Say we have two relations:
class Registrations < ROM::Relation[:sql] schema(:registrations, infer: true) associations do belongs_to :client end end
class Clients < ROM::Relation[:sql] schema(:clients, infer: true) end
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)
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
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?