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

**URL:** <https://discourse.rom-rb.org/t/aliased-association-doesnt-map-to-the-entity-of-the-relation/283>\
**Category:** Issues\
**Created:** [October 29, 2018, 2:13am UTC](https://discourse.rom-rb.org/t/aliased-association-doesnt-map-to-the-entity-of-the-relation/283 "2018-10-29T02:13:56Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/solnic/32/279_2.png) [@solnic](https://discourse.rom-rb.org/u/solnic)\
**Post date:** [February 12, 2019, 9:46am UTC](https://discourse.rom-rb.org/t/aliased-association-doesnt-map-to-the-entity-of-the-relation/283/4 "2019-02-12T09:46:41Z")

</div>

> [@joelvh](#):
>
> Thanks @solnic, sorry I didn’t reply sooner.

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

> [@joelvh](#):
>
> Seems a little odd that there isn’t an option to specify what it should be

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:

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

```

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

---

_[View the full topic](https://discourse.rom-rb.org/t/aliased-association-doesnt-map-to-the-entity-of-the-relation/283)._
