# Latest

**URL:** https://discourse.rom-rb.org/latest.md?page=5

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

**Page:** 6

---

## [Aliased association doesn't map to the entity of the relation](https://discourse.rom-rb.org/t/aliased-association-doesnt-map-to-the-entity-of-the-relation/283)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 3\
**Last updated:** [February 12, 2019, 9:46am UTC](https://discourse.rom-rb.org/t/aliased-association-doesnt-map-to-the-entity-of-the-relation/283 "2019-02-12T09:46:41Z")

</div>

Hi all, I’ve got a relation called identities. I have another relation called activities. Activities has a belongs\_to association called by, which is an alias for identities. For some reason, the struct that by is mapp…

---

## [Best way to alias attribute names](https://discourse.rom-rb.org/t/best-way-to-alias-attribute-names/262)

<div class="topic-metadata">

**Author:** [@ianks](https://discourse.rom-rb.org/u/ianks)\
**Replies:** 5\
**Last updated:** [January 24, 2019, 12:17pm UTC](https://discourse.rom-rb.org/t/best-way-to-alias-attribute-names/262 "2019-01-24T12:17:50Z")

</div>

We are using a legacy DB and would like to alias columns on the relation so we can query attributes with our own terminology. I see it’s possible to add a :meta key on the type with a possible qualified :sql\_expr, but it…

---

## [Default datasets, joins and aliases](https://discourse.rom-rb.org/t/default-datasets-joins-and-aliases/299)

<div class="topic-metadata">

**Author:** [@waiting-for-dev](https://discourse.rom-rb.org/u/waiting-for-dev)\
**Replies:** 6\
**Last updated:** [January 11, 2019, 10:55am UTC](https://discourse.rom-rb.org/t/default-datasets-joins-and-aliases/299 "2019-01-11T10:55:14Z")

</div>

I’m playing with rom SQL joins for first time in order to use them later in a real application. As example, I’m wondering how one should proceed to order by a joined table field. If I try: users.join(:tasks).order(:ta…

---

## [Custom query: i.e. WITH RECURSIVE](https://discourse.rom-rb.org/t/custom-query-i-e-with-recursive/298)

<div class="topic-metadata">

**Author:** [@mellowcoder](https://discourse.rom-rb.org/u/mellowcoder)\
**Replies:** 1\
**Last updated:** [January 9, 2019, 2:17pm UTC](https://discourse.rom-rb.org/t/custom-query-i-e-with-recursive/298 "2019-01-09T14:17:19Z")

</div>

Hello, rom-rb community. I’ve been having so much fun with ROM lately. So I just wanna say thank you all for all the work done. I’ve came across this little issue. I wanna use WITH RECURSIVE in a rom relation and I wa…

---

## [Aliases and custom dataset](https://discourse.rom-rb.org/t/aliases-and-custom-dataset/293)

<div class="topic-metadata">

**Author:** [@waiting-for-dev](https://discourse.rom-rb.org/u/waiting-for-dev)\
**Replies:** 3\
**Last updated:** [December 30, 2018, 6:13pm UTC](https://discourse.rom-rb.org/t/aliases-and-custom-dataset/293 "2018-12-30T18:13:20Z")

</div>

If we have some attribute aliased in the relation and we want to use a custom dataset, we have to do something like the following: class Foo \< ROM::Relation\[:sql\] schema(:foo, infer: true) do attribute :nmb, Types…

---

## [Aliased attributes in commands](https://discourse.rom-rb.org/t/aliased-attributes-in-commands/295)

<div class="topic-metadata">

**Author:** [@waiting-for-dev](https://discourse.rom-rb.org/u/waiting-for-dev)\
**Replies:** 3\
**Last updated:** [December 29, 2018, 11:47am UTC](https://discourse.rom-rb.org/t/aliased-attributes-in-commands/295 "2018-12-29T11:47:08Z")

</div>

I have been surprised by the fact that attribute aliases are not taken into account by commands. For example, if I have in the schema: attribute :foo, Types::String.meta(alias: :bar) The input for my command is expect…

---

## [Association not being loaded if foreign key is aliased](https://discourse.rom-rb.org/t/association-not-being-loaded-if-foreign-key-is-aliased/296)

<div class="topic-metadata">

**Author:** [@waiting-for-dev](https://discourse.rom-rb.org/u/waiting-for-dev)\
**Replies:** 1\
**Last updated:** [December 29, 2018, 11:31am UTC](https://discourse.rom-rb.org/t/association-not-being-loaded-if-foreign-key-is-aliased/296 "2018-12-29T11:31:19Z")

</div>

Say we have two relations: class Registrations \< ROM::Relation\[:sql\] schema(:registrations, infer: true) associations do belongs\_to :client end end class Clients \< ROM::Relation\[:sql\] schema(:clients, infe…

---

## [Ability to alias an attribute but keeping type inferred](https://discourse.rom-rb.org/t/ability-to-alias-an-attribute-but-keeping-type-inferred/289)

<div class="topic-metadata">

**Author:** [@waiting-for-dev](https://discourse.rom-rb.org/u/waiting-for-dev)\
**Replies:** 8\
**Last updated:** [December 15, 2018, 7:02am UTC](https://discourse.rom-rb.org/t/ability-to-alias-an-attribute-but-keeping-type-inferred/289 "2018-12-15T07:02:49Z")

</div>

If I’m not wrong, it is not possible to create an alias for a relation attribute without having to redefine its writer type, too: schema(:users, infer: true) do attribute :act, Type::Strict::Bool.meta(alias: :active) …

---

## [Conditionally chaining where blocks](https://discourse.rom-rb.org/t/conditionally-chaining-where-blocks/286)

<div class="topic-metadata">

**Author:** [@jacquesporveau](https://discourse.rom-rb.org/u/jacquesporveau)\
**Replies:** 1\
**Last updated:** [November 2, 2018, 4:18pm UTC](https://discourse.rom-rb.org/t/conditionally-chaining-where-blocks/286 "2018-11-02T16:18:39Z")

</div>

Does anyone have any ideas for solving the following problem? Looking to write a method that takes in a hash that has optional keys and based on whether there are certain keys present they conditionally chain where clau…

---

## [Caching API Discussion](https://discourse.rom-rb.org/t/caching-api-discussion/281)

<div class="topic-metadata">

**Author:** [@ianks](https://discourse.rom-rb.org/u/ianks)\
**Replies:** 1\
**Last updated:** [October 24, 2018, 9:18am UTC](https://discourse.rom-rb.org/t/caching-api-discussion/281 "2018-10-24T09:18:06Z")

</div>

In the original 5.0 roadmap there was a discussion about implementing a caching API. Although it’s not on the current roadmap for rom5, I think discussing the public interface / implementation would be a great way to get…

---

## [Changed 5.0.0 roadmap](https://discourse.rom-rb.org/t/changed-5-0-0-roadmap/278)

<div class="topic-metadata">

**Author:** [@solnic](https://discourse.rom-rb.org/u/solnic)\
**Replies:** 0\
**Last updated:** [October 3, 2018, 9:02am UTC](https://discourse.rom-rb.org/t/changed-5-0-0-roadmap/278 "2018-10-03T09:02:24Z")

</div>

Hey everyone! We’ve decided to simplify 5.0.0 release and make it much smaller than initially announced in this thread. The updated roadmap is as follows: rom-core Update to latest dry-types (currently 0.13.x but it …

---

## [Create multiple entities](https://discourse.rom-rb.org/t/create-multiple-entities/265)

<div class="topic-metadata">

**Author:** [@drqCode](https://discourse.rom-rb.org/u/drqCode)\
**Replies:** 1\
**Last updated:** [September 28, 2018, 2:59am UTC](https://discourse.rom-rb.org/t/create-multiple-entities/265 "2018-09-28T02:59:06Z")

</div>

I have this scenario when creating multiple (bulk) users with some existing tasks. The only bulk create implementation I have for now is to iterate through the list of new users, create a user, get his id and insert in U…

---

## [Null exception when attribute supplied](https://discourse.rom-rb.org/t/null-exception-when-attribute-supplied/271)

<div class="topic-metadata">

**Author:** [@robwold](https://discourse.rom-rb.org/u/robwold)\
**Replies:** 1\
**Last updated:** [August 28, 2018, 10:52am UTC](https://discourse.rom-rb.org/t/null-exception-when-attribute-supplied/271 "2018-08-28T10:52:21Z")

</div>

Hi, I’m brand new to ROM and trying to get to grips with it by coding something extremely simple from scratch, using sqlite3. I had the following problem: the below is copied verbatim from my StackOverflow post https://…

---

## [Not found exception](https://discourse.rom-rb.org/t/not-found-exception/263)

<div class="topic-metadata">

**Author:** [@calin](https://discourse.rom-rb.org/u/calin)\
**Replies:** 1\
**Last updated:** [July 1, 2018, 9:02am UTC](https://discourse.rom-rb.org/t/not-found-exception/263 "2018-07-01T09:02:05Z")

</div>

I need to show a 404 page when the record is not found, using one! I will get a ROM::TupleCountMismatchError exception. I expected something along the lines RecordNotFound as an exception is there a better way to do thi…

---

## [Chaining combines](https://discourse.rom-rb.org/t/chaining-combines/260)

<div class="topic-metadata">

**Author:** [@calin](https://discourse.rom-rb.org/u/calin)\
**Replies:** 3\
**Last updated:** [June 29, 2018, 4:04am UTC](https://discourse.rom-rb.org/t/chaining-combines/260 "2018-06-29T04:04:18Z")

</div>

Given I have 2 relations: class ShiftPositions \< ROM::Relation\[:sql\] schema(:shift\_positions, infer: true) do associations do belongs\_to :position belongs\_to :pay\_type end end def with\_positio…

---

## [Rom-sql upsert multiple entities by default](https://discourse.rom-rb.org/t/rom-sql-upsert-multiple-entities-by-default/240)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 8\
**Last updated:** [June 28, 2018, 7:47pm UTC](https://discourse.rom-rb.org/t/rom-sql-upsert-multiple-entities-by-default/240 "2018-06-28T19:47:41Z")

</div>

Hi, I was just working on upserting records and was surprised to see that upsert in rom-sql does not support multiple records at once. My assumption was that the command would support multiple entities at once like the …

---

## [Need help getting started and migrate complicated getter logic from ActiveRecord](https://discourse.rom-rb.org/t/need-help-getting-started-and-migrate-complicated-getter-logic-from-activerecord/258)

<div class="topic-metadata">

**Author:** [@stoivo](https://discourse.rom-rb.org/u/stoivo)\
**Replies:** 2\
**Last updated:** [June 24, 2018, 6:11pm UTC](https://discourse.rom-rb.org/t/need-help-getting-started-and-migrate-complicated-getter-logic-from-activerecord/258 "2018-06-24T18:11:59Z")

</div>

I need some help getting started. I am working on a rails app but have read about ROM and want to try it. But I have some problems getting started. What do I need to create to get started? We had some really slow code t…

---

## [Where with like](https://discourse.rom-rb.org/t/where-with-like/256)

<div class="topic-metadata">

**Author:** [@xero88](https://discourse.rom-rb.org/u/xero88)\
**Replies:** 2\
**Last updated:** [June 21, 2018, 12:30pm UTC](https://discourse.rom-rb.org/t/where-with-like/256 "2018-06-21T12:30:00Z")

</div>

I’m trying to search in my table. I found this : contacts.where { email.ilike('%myemail%') }.to\_a this work fine. But I want to do like this : contacts.where { "email".ilike('%myemail%') }.to\_a because my fields are…

---

## [Constructing complicated queries](https://discourse.rom-rb.org/t/constructing-complicated-queries/255)

<div class="topic-metadata">

**Author:** [@paul](https://discourse.rom-rb.org/u/paul)\
**Replies:** 0\
**Last updated:** [May 19, 2018, 9:33pm UTC](https://discourse.rom-rb.org/t/constructing-complicated-queries/255 "2018-05-19T21:33:36Z")

</div>

I have a moderately complicated data model in postgresql with lots of relations, and I need to gather them all together for display in a view. I have a Conversation which associates with a few other objects, which have …

---

## [ManyToMany when through relationship must be resolved before the has\_many](https://discourse.rom-rb.org/t/manytomany-when-through-relationship-must-be-resolved-before-the-has-many/252)

<div class="topic-metadata">

**Author:** [@ianks](https://discourse.rom-rb.org/u/ianks)\
**Replies:** 0\
**Last updated:** [May 9, 2018, 9:02pm UTC](https://discourse.rom-rb.org/t/manytomany-when-through-relationship-must-be-resolved-before-the-has-many/252 "2018-05-09T21:02:05Z")

</div>

Greetings! I am working on ROM adapter for an old SOAP API and I am current stuck on a problem with ManyToMany associations. As a bit of background, here is what my relations look like: ROM::Configuration.new(:adwords,…

---

## [ROM-SQL Changesets break Sequel's deadlock retry handling](https://discourse.rom-rb.org/t/rom-sql-changesets-break-sequels-deadlock-retry-handling/247)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 4\
**Last updated:** [May 3, 2018, 1:45am UTC](https://discourse.rom-rb.org/t/rom-sql-changesets-break-sequels-deadlock-retry-handling/247 "2018-05-03T01:45:14Z")

</div>

I’ve been making a lot of progress learning the ins and outs of ROM. While I’m learning to like it a lot, I’ve found that there are many functionalities that seem inconsistent between rom-core (interfaces) and rom-sql. S…

---

## [Refreshing file project](https://discourse.rom-rb.org/t/refreshing-file-project/248)

<div class="topic-metadata">

**Author:** [@xero88](https://discourse.rom-rb.org/u/xero88)\
**Replies:** 2\
**Last updated:** [May 2, 2018, 10:38pm UTC](https://discourse.rom-rb.org/t/refreshing-file-project/248 "2018-05-02T22:38:42Z")

</div>

Hi, I’m using rom-rb and dry-rb for a month. This work fine. Thank you for the job. The main issue that I have yet is that when I update a file, I need always to restart my server (i’m using foreman) Someone knows a w…

---

## [Memory relation Delete command fails because of mismatched types when deleting tuples from dataset](https://discourse.rom-rb.org/t/memory-relation-delete-command-fails-because-of-mismatched-types-when-deleting-tuples-from-dataset/249)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 3\
**Last updated:** [April 27, 2018, 5:35pm UTC](https://discourse.rom-rb.org/t/memory-relation-delete-command-fails-because-of-mismatched-types-when-deleting-tuples-from-dataset/249 "2018-04-27T17:35:40Z")

</div>

I’m implementing some ROM relations with the :memory adapter and have a failing test that seems like it should work. Calling the delete command doesn’t seem to delete tuples. Looking at the ROM tests for Memory-related c…

---

## [Mapping nested entities and other transformation examples](https://discourse.rom-rb.org/t/mapping-nested-entities-and-other-transformation-examples/223)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 8\
**Last updated:** [April 27, 2018, 5:31pm UTC](https://discourse.rom-rb.org/t/mapping-nested-entities-and-other-transformation-examples/223 "2018-04-27T17:31:37Z")

</div>

Hi all, Been reading up on ROM and my first project is a ROM adapter for the RailsEventStore project. I am still getting my head around the shift from ActiveRecord to this paradigm, but ROM is what I’ve been looking for…

---

## [Dynamic adapter question](https://discourse.rom-rb.org/t/dynamic-adapter-question/246)

<div class="topic-metadata">

**Author:** [@nlestat](https://discourse.rom-rb.org/u/nlestat)\
**Replies:** 1\
**Last updated:** [April 25, 2018, 7:31pm UTC](https://discourse.rom-rb.org/t/dynamic-adapter-question/246 "2018-04-25T19:31:22Z")

</div>

Hi, I’m sorry if this is a stupid question, I’ve not fully perused the documentation, but it seems like I am not able to use ROM to do what I want. What I have are a number of databases with the same structure, but I d…

---

## [Rom-sql relation's \`fetch\` doesn't seem to support mapping](https://discourse.rom-rb.org/t/rom-sql-relations-fetch-doesnt-seem-to-support-mapping/239)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 2\
**Last updated:** [April 25, 2018, 7:14pm UTC](https://discourse.rom-rb.org/t/rom-sql-relations-fetch-doesnt-seem-to-support-mapping/239 "2018-04-25T19:14:20Z")

</div>

I’ve created a finder method on my repository. When calling fetch on the association while specifying map\_with, the resulting entity is a struct instead of the mapped class. def by\_id(event\_id) events.map\_with(:mapped…

---

## [Store an entity in database and type mismatch when create command is run](https://discourse.rom-rb.org/t/store-an-entity-in-database-and-type-mismatch-when-create-command-is-run/106)

<div class="topic-metadata">

**Author:** [@Fire-Dragon-DoL](https://discourse.rom-rb.org/u/Fire-Dragon-DoL)\
**Replies:** 4\
**Last updated:** [April 24, 2018, 9:14am UTC](https://discourse.rom-rb.org/t/store-an-entity-in-database-and-type-mismatch-when-create-command-is-run/106 "2018-04-24T09:14:16Z")

</div>

Hi everyone! Exploring ROM and facing my first couple of issues. I'm creating a logger library which for now will just log to a database (in future, will do other things), so my basic first step is to just write somethin…

---

## [Instantiating a custom Struct instance](https://discourse.rom-rb.org/t/instantiating-a-custom-struct-instance/224)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 5\
**Last updated:** [April 17, 2018, 6:36pm UTC](https://discourse.rom-rb.org/t/instantiating-a-custom-struct-instance/224 "2018-04-17T18:36:52Z")

</div>

I have an Events relation that defines a schema. I’ve configured it to use the Event struct, which inherits from ROM::Struct. How can I instantiate a new Event instance and then use the create command to insert new recor…

---

## [Changeset \`:create\` command with aliased PK doesn't seem to map back to database column](https://discourse.rom-rb.org/t/changeset-create-command-with-aliased-pk-doesnt-seem-to-map-back-to-database-column/225)

<div class="topic-metadata">

**Author:** [@joelvh](https://discourse.rom-rb.org/u/joelvh)\
**Replies:** 2\
**Last updated:** [April 13, 2018, 12:16am UTC](https://discourse.rom-rb.org/t/changeset-create-command-with-aliased-pk-doesnt-seem-to-map-back-to-database-column/225 "2018-04-13T00:16:44Z")

</div>

I’ve created a relation where the id is aliased to event\_id. When I try to create new records by committing the changeset with data that has an event\_id value pre-populated, the value is not persisted to the id column (g…

---

## [Changeset for combined relations](https://discourse.rom-rb.org/t/changeset-for-combined-relations/218)

<div class="topic-metadata">

**Author:** [@drqCode](https://discourse.rom-rb.org/u/drqCode)\
**Replies:** 3\
**Last updated:** [April 10, 2018, 9:13am UTC](https://discourse.rom-rb.org/t/changeset-for-combined-relations/218 "2018-04-10T09:13:52Z")

</div>

Hi! In this video: https://youtu.be/HVBkcq\_7gJI?t=31m41s, you have used a create changeset for a combined relation. The case is trivial, I have 2 sql tables with one-to-many relationship. The relation schemas are infered…

[Previous page](https://discourse.rom-rb.org/latest.md?page=4)

[Next page](https://discourse.rom-rb.org/latest.md?page=6)
