Aliased association doesn't map to the entity of the relation


Hi all,

I’ve got a relation called identities. I have another relation called activities. Activities has a belongs_to association called by, which is an alias for identities.

For some reason, the struct that by is mapped to is a By entity instead of Identity from the identities relation.

How do I get an assoociation to use the struct frrom the relation?




Struct inference uses relation names, so if they are aliased, which is what happens when you use belongs_to, a different name is used than the default one. You could workaround that like this:

activities.combine(:by).node(:by) { |n| }

…which is obviously weird, but should work :wink: