# Combine cross-gateway relations

**URL:** <https://discourse.rom-rb.org/t/combine-cross-gateway-relations/204>\
**Category:** Issues\
**Created:** [January 8, 2018, 9:40pm UTC](https://discourse.rom-rb.org/t/combine-cross-gateway-relations/204 "2018-01-08T21:40:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![v-kolesnikov](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/v-kolesnikov/32/111_2.png) [@v-kolesnikov](https://discourse.rom-rb.org/u/v-kolesnikov)\
**Post date:** [January 8, 2018, 9:40pm UTC](https://discourse.rom-rb.org/t/combine-cross-gateway-relations/204/1 "2018-01-08T21:40:22Z")

</div>

Hi all!  
Has anyone done cross-gateway custom mappers? I tried to do it but failed. I prepared some examples which illustrate these problems: [https://github.com/v-kolesnikov/rom-bugs/pull/1/files](https://github.com/v-kolesnikov/rom-bugs/pull/1/files), [https://github.com/v-kolesnikov/rom-bugs/pull/2/files](https://github.com/v-kolesnikov/rom-bugs/pull/2/files)  
I need to combine some relations from different gateways and adapters. I have a really bad data-storage design, I know, but it is reality unfortunately.

---

<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:** [January 9, 2018, 7:34pm UTC](https://discourse.rom-rb.org/t/combine-cross-gateway-relations/204/2 "2018-01-09T19:34:29Z")

</div>

huh nice use case you’ve got there 😃 I’ll dig into it once I’ve got some time and get back to you.

---

<div class="post-metadata">

**Author:** ![v-kolesnikov](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/v-kolesnikov/32/111_2.png) [@v-kolesnikov](https://discourse.rom-rb.org/u/v-kolesnikov)\
**Post date:** [January 9, 2018, 9:47pm UTC](https://discourse.rom-rb.org/t/combine-cross-gateway-relations/204/3 "2018-01-09T21:47:48Z")

</div>

Thank you Piotr! I’ll strive to have in done too. I think - `combine_with` is not what we need when we are dealing with cases such this. Improving an associations DSL for adapters seems like a better idea. (I could be wrong).

---

<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:** [January 9, 2018, 10:00pm UTC](https://discourse.rom-rb.org/t/combine-cross-gateway-relations/204/4 "2018-01-09T22:00:37Z")

</div>

Oh yeah, we _definitely_ need to add association support to rom-mongo adapter, because as long as you can simply return tuples with combine keys included, auto-mapping will just work, and you’ll get back nested data structures. For the time being though, I _think_ you should be able to achieve what you need in a slighly simpler way.
