rom-rb / rom-sql

SQL support for rom-rb

Home Page:https://rom-rb.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefining `by_pk` causes stack overflow in auto_curry

solnic opened this issue · comments

Introduced in 869b46be

Steps to repro:

require 'rom'
require 'rom-sql'
require 'rom-repository'

module Relations
  class Users < ROM::Relation[:sql]
    schema(:users, infer: true)
  end
end

class UserRepository < ROM::Repository[:users]
  def find(uuid)
    users.by_pk(uuid).one
  end
end

def build_container(rom_base)
  config = ROM::Configuration.new(:sql, 'postgres://localhost/rom_test')
  config.register_relation(Relations::Users)
  ROM.container(config)
end

rom_base = ROM::Configuration.new(:sql, 'postgres://localhost/rom_test')

5.times do
  rom = build_container(rom_base)
  repo = UserRepository.new(rom)
  repo.find(1)
  rom.disconnect
  puts "\n"
end