Open
Description
Describe the bug
When using by_pk
with one value while the table has composite primary key, ROM can raise stack overflow error.
To Reproduce
- Create a table in DB:
create table users (
id VARCHAR(50),
tenant_id VARCHAR(50),
primary key (id, tenant_id)
)
- Run the below snippet
require "rom"
rom = ROM.container(:sql, 'postgres://localhost/test') do |config|
config.relation(:users) do
schema(infer: true)
auto_struct true
end
end
users = rom.relations[:users]
users.by_pk('0049d2d1-b433-48d7-818a-a2672ae05fa').one
Expected behavior
The error should be raised with incorrect number of argument message.
My environment
- Affects my production application: NO
- Ruby version: 3.3.0
- OS: MacOS 14.4.1