Closed pboling closed 1 week ago
I know this is a year old but if you change:
conf.relation(:users) do
end
to
conf.relation(:users) do
schema(infer: true)
auto_struct true
end
then it works as desired.
The reason is: "ROM's open structs are used for relations with empty schemas"
👍
Closing. This was a problem of documentation and is fixed in the main
branch.
Describe the bug
I made a script of the example code, and it seems that the example code for the auto-generated structs no longer reflects reality, and as a result I am very confused about how to setup my custom name-spaced structs, when not even the auto-generated ones work as expected.
The example code I mostly copied is here: https://api.rom-rb.org/rom/ROM/Struct Note that as written the example code doesn't work at all, as it was missing the
conf.relation(:users)
, so I added that. Even with that, the example code still doesn't work at all, and raises the error:undefined method 'schema' for ROM::OpenStruct:Class (NoMethodError)
To Reproduce
My environment