rom-sql
rom-sql copied to clipboard
Missing fk-constraint does not map properly for combines
Describe the bug
Given a standard one-to-many relationship Posts and Comments, where comments table has a post_id without a foreign-key constraint, the usage of combine will map every relationship to the primary node.
To Reproduce
Provide detailed steps to reproduce, an executable script would be best.
rom.relations[:posts].combine(:comments)
Expected behavior Unsure, but warnings/documentation could help.
- Perhaps, warn/error when missing fk?
- Require "virtual_foreign_key"?
Your environment
- Affects my production application: NO
- Ruby version: 2.6.x, rails 5.2
- OS: Catalina