# Issues

**URL:** https://discourse.rom-rb.org/c/got-any-issues-with-rom-any-questions-concerns-post-them-here/5.md?page=1

[Latest](https://discourse.rom-rb.org/latest.md) · [Categories](https://discourse.rom-rb.org/categories.md)

**Page:** 2

---

## [Associations between multiple databases](https://discourse.rom-rb.org/t/associations-between-multiple-databases/577)

<div class="topic-metadata">

**Author:** [@wbr](https://discourse.rom-rb.org/u/wbr)\
**Replies:** 3\
**Last updated:** [January 11, 2023, 10:58pm UTC](https://discourse.rom-rb.org/t/associations-between-multiple-databases/577 "2023-01-11T22:58:45Z")

</div>

Hi, I’ve been using ROM for several years but never between multiple databases at once, until now. I’m trying to create an association between a postgres relation and a sqlite relation. My container has two gateways, one…

---

## [Is there a possibility to skip the tuple-diff check at update-changesets?](https://discourse.rom-rb.org/t/is-there-a-possibility-to-skip-the-tuple-diff-check-at-update-changesets/575)

<div class="topic-metadata">

**Author:** [@wuarmin](https://discourse.rom-rb.org/u/wuarmin)\
**Replies:** 0\
**Last updated:** [December 22, 2022, 8:23am UTC](https://discourse.rom-rb.org/t/is-there-a-possibility-to-skip-the-tuple-diff-check-at-update-changesets/575 "2022-12-22T08:23:30Z")

</div>

Hey, I want to use the update changeset, but want to skip the tuple-diff-check, which results in a extra sql, of the tuple, which is too expensive? Is that possible? Or do you recommend not using changesets in that cas…

---

## [Select\_append and factories](https://discourse.rom-rb.org/t/select-append-and-factories/566)

<div class="topic-metadata">

**Author:** [@katafrakt](https://discourse.rom-rb.org/u/katafrakt)\
**Replies:** 1\
**Last updated:** [November 27, 2022, 4:52pm UTC](https://discourse.rom-rb.org/t/select-append-and-factories/566 "2022-11-27T16:52:43Z")

</div>

Hello. I have a Threads relation that has\_many :messages. When fetching thread list in the repository, I use select\_append to add message\_count value to the result. Something like this: def with\_count left\_join(messag…

---

## [Mapper logic reuse - suggestions needed](https://discourse.rom-rb.org/t/mapper-logic-reuse-suggestions-needed/559)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 3\
**Last updated:** [October 17, 2022, 7:22pm UTC](https://discourse.rom-rb.org/t/mapper-logic-reuse-suggestions-needed/559 "2022-10-17T19:22:29Z")

</div>

Hello, I am noticing two patterns: I am creating a mapper for each unique combination of #combine inputs I having a lot of repeating code in my mappers across different relations when I combine associations. Do you h…

---

## [Aggregate write with mapper =\> mapper called 2x](https://discourse.rom-rb.org/t/aggregate-write-with-mapper-mapper-called-2x/558)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 2\
**Last updated:** [October 1, 2022, 12:59pm UTC](https://discourse.rom-rb.org/t/aggregate-write-with-mapper-mapper-called-2x/558 "2022-10-01T12:59:29Z")

</div>

Greetings! The following command (aggregate write) creates correctly but calls the mapper twice. Is this expected behaviour? my\_relation.combine(\[:my\_assoc\]) .command(:create, mapper: :my\_mapper, …

---

## [Delete Cascade to include associated records?](https://discourse.rom-rb.org/t/delete-cascade-to-include-associated-records/556)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 8:57am UTC](https://discourse.rom-rb.org/t/delete-cascade-to-include-associated-records/556 "2022-09-16T08:57:14Z")

</div>

Is it possible to delete records that have an association (foreign key) to schedule\_elements in a single call? Do I just combine the associated relation? schedule\_elements.where(conditions).command(:delete, result: :man…

---

## [Delete command on relation should return all deleted entities](https://discourse.rom-rb.org/t/delete-command-on-relation-should-return-all-deleted-entities/228)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 4\
**Last updated:** [September 13, 2022, 7:51pm UTC](https://discourse.rom-rb.org/t/delete-command-on-relation-should-return-all-deleted-entities/228 "2022-09-13T19:51:20Z")

</div>

According to the code comments, the delete command should return the deleted entities. However, they return one. relation.changeset(:create, {id: 1}, {id: 2}, {id: 3}).commit result = relation.command(:delete).call # …

---

## [Complex conditions: passing a block to where + schema alias](https://discourse.rom-rb.org/t/complex-conditions-passing-a-block-to-where-schema-alias/555)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 5\
**Last updated:** [September 1, 2022, 1:44pm UTC](https://discourse.rom-rb.org/t/complex-conditions-passing-a-block-to-where-schema-alias/555 "2022-09-01T13:44:00Z")

</div>

Where can I find more documentation on restriction DSL to compose more complex conditions? And more specifically if a schema has an alias (… infer: true, as: :events do …) how do I refer to it in a view? def with…

---

## [Why Entity.new does not set attributes?](https://discourse.rom-rb.org/t/why-entity-new-does-not-set-attributes/554)

<div class="topic-metadata">

**Author:** [@swilgosz](https://discourse.rom-rb.org/u/swilgosz)\
**Replies:** 2\
**Last updated:** [August 25, 2022, 9:23am UTC](https://discourse.rom-rb.org/t/why-entity-new-does-not-set-attributes/554 "2022-08-25T09:23:09Z")

</div>

Hi there! Entities are supposed to be very simple struct-like objects, and they use Dry::Struct under the hood. I guess it’s reasonable, that I expect the initialization can happen in the similar way. However, MyEntit…

---

## [Schema Coercion mysql / sqlite integer to boolean](https://discourse.rom-rb.org/t/schema-coercion-mysql-sqlite-integer-to-boolean/551)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 4\
**Last updated:** [August 11, 2022, 2:41pm UTC](https://discourse.rom-rb.org/t/schema-coercion-mysql-sqlite-integer-to-boolean/551 "2022-08-11T14:41:26Z")

</div>

Can someone give me an example of how this can be done? OR how I should be reading these values (0/1) from the database to have them represented by ruby false and true? Thanks!

---

## [Relation #wrap where foreign key is nil](https://discourse.rom-rb.org/t/relation-wrap-where-foreign-key-is-nil/550)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 0\
**Last updated:** [August 8, 2022, 1:19pm UTC](https://discourse.rom-rb.org/t/relation-wrap-where-foreign-key-is-nil/550 "2022-08-08T13:19:28Z")

</div>

Hello, it looks like the relation #to\_a returns an empty array when you try to wrap an association with nil… \> conditions =\> {:schedule\_id=\>nil} \> schedule\_elements.where(conditions).to\_a =\> \[{:created\_at=\>2022-08-08 1…

---

## [Support transient attributes in rom-factory](https://discourse.rom-rb.org/t/support-transient-attributes-in-rom-factory/540)

<div class="topic-metadata">

**Author:** [@masterT](https://discourse.rom-rb.org/u/masterT)\
**Replies:** 3\
**Last updated:** [July 26, 2022, 5:36am UTC](https://discourse.rom-rb.org/t/support-transient-attributes-in-rom-factory/540 "2022-07-26T05:36:41Z")

</div>

It would be useful to have something similar to FactoryBot transient attributes in rom-factory. Something like this. Factory.define(:user) do |f| f.transient do |t| t.password { 'P@ssword123!' } end f.name {…

---

## [Subquery Inner Join](https://discourse.rom-rb.org/t/subquery-inner-join/542)

<div class="topic-metadata">

**Author:** [@neroy](https://discourse.rom-rb.org/u/neroy)\
**Replies:** 0\
**Last updated:** [July 14, 2022, 3:49pm UTC](https://discourse.rom-rb.org/t/subquery-inner-join/542 "2022-07-14T15:49:52Z")

</div>

I have a question. How can I write a query like this in rom: SELECT COUNT(\*) FROM "table\_a" INNER JOIN ( SELECT "column\_x" FROM "table\_b" WHERE "table\_b"."column\_y" = '\<whatever\>' ORDER BY "table\_b"."column\_y" asc…

---

## [CREATE command with no result](https://discourse.rom-rb.org/t/create-command-with-no-result/538)

<div class="topic-metadata">

**Author:** [@paddor](https://discourse.rom-rb.org/u/paddor)\
**Replies:** 1\
**Last updated:** [May 23, 2022, 10:31am UTC](https://discourse.rom-rb.org/t/create-command-with-no-result/538 "2022-05-23T10:31:36Z")

</div>

I want to create multiple records and I don’t want a follow-up SELECT to be executed. Is there a way to avoid the automatic SELECT query? Currently doing this: my\_relation.command(:create, result: :one).call records A…

---

## [Create commands with result :none](https://discourse.rom-rb.org/t/create-commands-with-result-none/479)

<div class="topic-metadata">

**Author:** [@wuarmin](https://discourse.rom-rb.org/u/wuarmin)\
**Replies:** 1\
**Last updated:** [May 18, 2022, 2:37pm UTC](https://discourse.rom-rb.org/t/create-commands-with-result-none/479 "2022-05-18T14:37:48Z")

</div>

Hey, I have the use-case of returning nothing from a command. Here’s an example of an bulk-update-command: def update\_status(old\_status\_id:, new\_status\_id:) records .where(status\_id: old\_status\_id) .command(:…

---

## [Create nested entities for existing parent entity](https://discourse.rom-rb.org/t/create-nested-entities-for-existing-parent-entity/244)

<div class="topic-metadata">

**Author:** [@drqCode](https://discourse.rom-rb.org/u/drqCode)\
**Replies:** 1\
**Last updated:** [May 10, 2022, 4:53pm UTC](https://discourse.rom-rb.org/t/create-nested-entities-for-existing-parent-entity/244 "2022-05-10T16:53:24Z")

</div>

class Users \< ROM::Relation\[:sql\] schema(:users, infer: true) do associations do has\_many :tasks end end end class Tasks \< ROM::Relation\[:sql\] schema(:users, …

---

## [Is it possible to aggregate write to a self reference table?](https://discourse.rom-rb.org/t/is-it-possible-to-aggregate-write-to-a-self-reference-table/537)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 2\
**Last updated:** [May 8, 2022, 10:20am UTC](https://discourse.rom-rb.org/t/is-it-possible-to-aggregate-write-to-a-self-reference-table/537 "2022-05-08T10:20:50Z")

</div>

I have a table with a column parent\_id which is a foreign key to itself. Is it possible to combine the relation to itself for create command? categories\_relation.combine(:categories).command(:create).call(data) My atte…

---

## [Qualifying columns in where clause](https://discourse.rom-rb.org/t/qualifying-columns-in-where-clause/536)

<div class="topic-metadata">

**Author:** [@synusynu](https://discourse.rom-rb.org/u/synusynu)\
**Replies:** 2\
**Last updated:** [April 27, 2022, 11:06am UTC](https://discourse.rom-rb.org/t/qualifying-columns-in-where-clause/536 "2022-04-27T11:06:12Z")

</div>

Hi, i have a quick question :slight\_smile: How can we qualify column in where clause? I want to use columns from joined table in where clause, but i can’t get how it could be easily done The only thing i found after …

---

## [Setting an association by passing tuple rather than id](https://discourse.rom-rb.org/t/setting-an-association-by-passing-tuple-rather-than-id/528)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 1\
**Last updated:** [April 19, 2022, 6:53am UTC](https://discourse.rom-rb.org/t/setting-an-association-by-passing-tuple-rather-than-id/528 "2022-04-19T06:53:20Z")

</div>

Greetings, Is it possible to create associations in this manner? tasks\_repo.create({ id: 1, user: {id: 1, name: "Jane"}, title: "Jane's task" }) Not an Aggregate Write as the user tuple has an id and there is no combi…

---

## [Relation Schemas and Attribute Types](https://discourse.rom-rb.org/t/relation-schemas-and-attribute-types/534)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 0\
**Last updated:** [April 18, 2022, 7:07pm UTC](https://discourse.rom-rb.org/t/relation-schemas-and-attribute-types/534 "2022-04-18T19:07:30Z")

</div>

Hi, I have a MySQL db with a field called “effective\_at” that has a type of “datetime”. I would like the read type of the attribute to be a ruby DateTime. With infer = true I get a ruby Time returned. I have tried overr…

---

## [Relation create command returns Array, expect Hash! ROM crash](https://discourse.rom-rb.org/t/relation-create-command-returns-array-expect-hash-rom-crash/516)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 8\
**Last updated:** [April 9, 2022, 8:31am UTC](https://discourse.rom-rb.org/t/relation-create-command-returns-array-expect-hash-rom-crash/516 "2022-04-09T08:31:13Z")

</div>

Thank you for creating such an amazing tool. I appreciate the separation of concerns! I can change the underlying db from mysql to pg to sqlite memory via only simple config changes - amazing!!! I’m running into an issu…

---

## [How to combine multiple UPDATE statements?](https://discourse.rom-rb.org/t/how-to-combine-multiple-update-statements/524)

<div class="topic-metadata">

**Author:** [@paddor](https://discourse.rom-rb.org/u/paddor)\
**Replies:** 1\
**Last updated:** [April 4, 2022, 8:56am UTC](https://discourse.rom-rb.org/t/how-to-combine-multiple-update-statements/524 "2022-04-04T08:56:58Z")

</div>

I’d like to update many records more efficiently. UPSERT is not an option since we’re not using PostgreSQL at the moment. The problem is that every UPDATE statement only affects one row, so every row needs its own statem…

---

## [ROM::MapperMissingError in simple scenario](https://discourse.rom-rb.org/t/rom-mappermissingerror-in-simple-scenario/511)

<div class="topic-metadata">

**Author:** [@swalke16](https://discourse.rom-rb.org/u/swalke16)\
**Replies:** 10\
**Last updated:** [March 31, 2022, 10:59am UTC](https://discourse.rom-rb.org/t/rom-mappermissingerror-in-simple-scenario/511 "2022-03-31T10:59:34Z")

</div>

Scenario: Brand new Rails 6.1 project with postgres database using rom-rails 2.3.0, rom 5.2.6, rom-sql 3.5.0. Code: class MembersRelation \< ROM::Relation\[:sql\] schema(:members, infer: true) auto\_map true end cla…

---

## [Handling storage validations that are not enforced by the db?](https://discourse.rom-rb.org/t/handling-storage-validations-that-are-not-enforced-by-the-db/508)

<div class="topic-metadata">

**Author:** [@jedschneider](https://discourse.rom-rb.org/u/jedschneider)\
**Replies:** 4\
**Last updated:** [March 23, 2022, 6:52am UTC](https://discourse.rom-rb.org/t/handling-storage-validations-that-are-not-enforced-by-the-db/508 "2022-03-23T06:52:53Z")

</div>

Hi, If I understand the repo pattern correctly, we should be relying on database constraints to manage as much of the integrity of the datastore as possible, via things like uniq indexes and other datastore abstractions.…

---

## [Range types (tsrange) and micro seconds precision](https://discourse.rom-rb.org/t/range-types-tsrange-and-micro-seconds-precision/509)

<div class="topic-metadata">

**Author:** [@DangerDawson](https://discourse.rom-rb.org/u/DangerDawson)\
**Replies:** 2\
**Last updated:** [March 18, 2022, 10:10am UTC](https://discourse.rom-rb.org/t/range-types-tsrange-and-micro-seconds-precision/509 "2022-03-18T10:10:53Z")

</div>

Currently if you create record that contains a value which is Values::Range of type tsrange then you lose the micro second precision on the lower and upper values. This is because the object is being serialised into a s…

---

## [Associations and combines with Memory Adapter](https://discourse.rom-rb.org/t/associations-and-combines-with-memory-adapter/502)

<div class="topic-metadata">

**Author:** [@jedschneider](https://discourse.rom-rb.org/u/jedschneider)\
**Replies:** 2\
**Last updated:** [March 13, 2022, 6:30pm UTC](https://discourse.rom-rb.org/t/associations-and-combines-with-memory-adapter/502 "2022-03-13T18:30:10Z")

</div>

Hi folks, TL;DR I’m working on using the Memory adapter to create an in-memory store for testing purposes (mocking an external service) where I’d prefer not to include an external dep like sqlite. I’m having trouble figu…

---

## [Database Query Caching](https://discourse.rom-rb.org/t/database-query-caching/505)

<div class="topic-metadata">

**Author:** [@palle](https://discourse.rom-rb.org/u/palle)\
**Replies:** 1\
**Last updated:** [March 13, 2022, 11:06am UTC](https://discourse.rom-rb.org/t/database-query-caching/505 "2022-03-13T11:06:39Z")

</div>

Hey guys, i just started working with ROM and it’s awesome far! I’m wondering if there’s any API to cache database queries with redis, memcached, etc or if i have to implement such functionality myself. Since I couldn…

---

## [Association JOIN/combine on array column](https://discourse.rom-rb.org/t/association-join-combine-on-array-column/300)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 1\
**Last updated:** [March 10, 2022, 8:26am UTC](https://discourse.rom-rb.org/t/association-join-combine-on-array-column/300 "2022-03-10T08:26:22Z")

</div>

I’ve been spending a lot of time trying to get a join on an array column to work, and I’ve got the query, but can’t get the combine to work. I’m using ROM SQL. I’ve got a relation called requests which has an array colu…

---

## [Join query returning duplicate results](https://discourse.rom-rb.org/t/join-query-returning-duplicate-results/500)

<div class="topic-metadata">

**Author:** [@davidtkramer](https://discourse.rom-rb.org/u/davidtkramer)\
**Replies:** 1\
**Last updated:** [February 14, 2022, 7:04am UTC](https://discourse.rom-rb.org/t/join-query-returning-duplicate-results/500 "2022-02-14T07:04:08Z")

</div>

Hi, I have a question about expected behavior with joins and combines in rom-sql. I’ve noticed that when joining with has\_many relationships, rom will return a duplicate of the parent record for each child record. I kno…

---

## [Replacement for AR's dependent: destroy](https://discourse.rom-rb.org/t/replacement-for-ars-dependent-destroy/462)

<div class="topic-metadata">

**Author:** [@ineu](https://discourse.rom-rb.org/u/ineu)\
**Replies:** 6\
**Last updated:** [January 31, 2022, 4:04pm UTC](https://discourse.rom-rb.org/t/replacement-for-ars-dependent-destroy/462 "2022-01-31T16:04:14Z")

</div>

Hello. I have started playing with ROM in a simple Rails project, gradually reimplementing functionality to study ROM. I have faced few issues that’s not relevant to this topic, I might open other tickets for them later…

[Previous page](https://discourse.rom-rb.org/c/got-any-issues-with-rom-any-questions-concerns-post-them-here/5.md)

[Next page](https://discourse.rom-rb.org/c/got-any-issues-with-rom-any-questions-concerns-post-them-here/5.md?page=2)
