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

No worries, as you can see, I know how it goes :smiley:

Adding a dedicated option that would specify which entity name should be used can be done relatively easily. I guess it could be called struct_class, so ie:

belongs_to :identities, as: :by, struct_class: 'Identity'

Alternatively we could use an option that would prevent struct inferrer from using the alias.