# Latest

**URL:** https://discourse.rom-rb.org/latest.md?no_subcategories=false&page=2

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

**Page:** 3

---

## [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…

---

## [How to register changesets with rom config](https://discourse.rom-rb.org/t/how-to-register-changesets-with-rom-config/535)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 3\
**Last updated:** [April 28, 2022, 5:29am UTC](https://discourse.rom-rb.org/t/how-to-register-changesets-with-rom-config/535 "2022-04-28T05:29:52Z")

</div>

The guide ROM - Framework setup mentions relations, commands, and mappers but nothing on changesets. I am currently using auto\_registration with a namespace. I have tried a few things to no avail. Where should I put thi…

---

## [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…

---

## [How can I improve this query?](https://discourse.rom-rb.org/t/how-can-i-improve-this-query/533)

<div class="topic-metadata">

**Author:** [@elithecho](https://discourse.rom-rb.org/u/elithecho)\
**Replies:** 0\
**Last updated:** [April 18, 2022, 11:37am UTC](https://discourse.rom-rb.org/t/how-can-i-improve-this-query/533 "2022-04-18T11:37:40Z")

</div>

I have a small repo for trying out ROM and using multi\_insert. I think it could be improved but am wondering how can I do this without a separate query?

---

## [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…

---

## [BoF meetup at RailsConf 2022](https://discourse.rom-rb.org/t/bof-meetup-at-railsconf-2022/525)

<div class="topic-metadata">

**Author:** [@jedschneider](https://discourse.rom-rb.org/u/jedschneider)\
**Replies:** 0\
**Last updated:** [April 1, 2022, 4:39pm UTC](https://discourse.rom-rb.org/t/bof-meetup-at-railsconf-2022/525 "2022-04-01T16:39:25Z")

</div>

I made a similar announcement in the Dry RB discourse as well, so this is a bit of an xpost. Being local to Portland, its easy(er) for me to organize something if anyone is planning to attend RailsConf this year and want…

---

## [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…

---

## [ROM::Processor::Transproc::Functions missing Recursion](https://discourse.rom-rb.org/t/rom-functions-missing-recursion/518)

<div class="topic-metadata">

**Author:** [@codeslinger](https://discourse.rom-rb.org/u/codeslinger)\
**Replies:** 1\
**Last updated:** [March 28, 2022, 7:19am UTC](https://discourse.rom-rb.org/t/rom-functions-missing-recursion/518 "2022-03-28T07:19:22Z")

</div>

Is there a reason “import ::Transproc::Recursion” has been omitted?

---

## [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…

---

## [Building a ROM plugin for Airtable](https://discourse.rom-rb.org/t/building-a-rom-plugin-for-airtable/495)

<div class="topic-metadata">

**Author:** [@pmackay](https://discourse.rom-rb.org/u/pmackay)\
**Replies:** 2\
**Last updated:** [February 23, 2022, 8:54pm UTC](https://discourse.rom-rb.org/t/building-a-rom-plugin-for-airtable/495 "2022-02-23T20:54:21Z")

</div>

I’m looking at using ROM with Airtable. Each “base” in Airtable has a clear REST API that is based on the structure of the tables added to the base. Based on the docs from the rom-http 0.8.0 tag, I can see 3 possible way…

---

## [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…

---

## [How to create Entity programmatically with relations?](https://discourse.rom-rb.org/t/how-to-create-entity-programmatically-with-relations/498)

<div class="topic-metadata">

**Author:** [@wuarmin](https://discourse.rom-rb.org/u/wuarmin)\
**Replies:** 2\
**Last updated:** [February 3, 2022, 7:28am UTC](https://discourse.rom-rb.org/t/how-to-create-entity-programmatically-with-relations/498 "2022-02-03T07:28:12Z")

</div>

Hey, I need to create an Entity programmatically, but I have issues. I have an entity Booking (id, name, area) which holds an Area (id, name) and I need to create this Bookings from hashes: # relation module Relatio…

---

## [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…

---

## [Does rom-sql support something like Sequel's #from\_self?](https://discourse.rom-rb.org/t/does-rom-sql-support-something-like-sequels-from-self/496)

<div class="topic-metadata">

**Author:** [@wuarmin](https://discourse.rom-rb.org/u/wuarmin)\
**Replies:** 2\
**Last updated:** [January 20, 2022, 9:00am UTC](https://discourse.rom-rb.org/t/does-rom-sql-support-something-like-sequels-from-self/496 "2022-01-20T09:00:25Z")

</div>

In Sequel there is a #from\_self method, which returns a dataset selecting from the current dataset. https://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html#method-i-from\_self I want to achieve this with rom-rb.…

---

## [How to use template-gem?](https://discourse.rom-rb.org/t/how-to-use-template-gem/493)

<div class="topic-metadata">

**Author:** [@pmackay](https://discourse.rom-rb.org/u/pmackay)\
**Replies:** 1\
**Last updated:** [January 4, 2022, 9:05am UTC](https://discourse.rom-rb.org/t/how-to-use-template-gem/493 "2022-01-04T09:05:37Z")

</div>

Are there any docs on how to use template-gem to start creating a new ROM gem? Could the project itself have its own README, that must be removed when cloning to make a new gem?

---

## [Classifying rom gems in Ruby Toolbox](https://discourse.rom-rb.org/t/classifying-rom-gems-in-ruby-toolbox/492)

<div class="topic-metadata">

**Author:** [@pmackay](https://discourse.rom-rb.org/u/pmackay)\
**Replies:** 1\
**Last updated:** [January 4, 2022, 9:04am UTC](https://discourse.rom-rb.org/t/classifying-rom-gems-in-ruby-toolbox/492 "2022-01-04T09:04:04Z")

</div>

I use Ruby Toolbox quite a lot when reviewing gems. The addition and classification of ROM gems could be improved on there. Just curious on people’s thoughts about which of these seems more appropriate: Add rom gems to…

---

## [Did anyone actually make this work with Ruby on Rails?](https://discourse.rom-rb.org/t/did-anyone-actually-make-this-work-with-ruby-on-rails/490)

<div class="topic-metadata">

**Author:** [@idchlife](https://discourse.rom-rb.org/u/idchlife)\
**Replies:** 0\
**Last updated:** [November 25, 2021, 8:49pm UTC](https://discourse.rom-rb.org/t/did-anyone-actually-make-this-work-with-ruby-on-rails/490 "2021-11-25T20:49:22Z")

</div>

Hey there! I’m trying to learn Ruby on Rails since I learned there is data mapper ORM for ruby (active record was major stopper for me in learning ruby). Did anyone actually used ROM with Ruby with Mysql/PostgreSQL/SQLit…

[Previous page](https://discourse.rom-rb.org/latest.md?no_subcategories=false&page=1)

[Next page](https://discourse.rom-rb.org/latest.md?no_subcategories=false&page=3)
