Sorry for the late reply, busy these last few weeks.
After thinking about this a little more, I think we definitely should add a way to ensure a proper struct/entity is generated. I see two options:
-
Specify the exact
class
that should be inherited from when building the struct class. -
And/or specify the behavior the resulting struct should have by allowing modules to be included when building the class.
So something like:
class Product < ROM::Relation[:sql]
decorate(
AttachedFile[:warranty],
Reviewable,
Categorizable
)
# ...
end
This would be nice because it makes it much less tedious to setup commonly used data access methods, without having to drop into another file/etc. I often find myself hopping around to do this when all I really need is some simple behavior.
I think having the ability to do both 1 and 2 would be a huge win