I have just started a new project and I decided to try and use a combination of grape, dry-rb and rom-rb instead of a rails stack.
So far things are going slow but okay. I have however finally hit an issue that I would like some advice on.
I am using rom-sql and rom-repository with a postgres backend.
The methods I have put into my repos return models rather than raw ROM::Structs.
def by_id(id) assets.fetch(id).as(Asset) end
This works fine.
My question is what invocation do I need to perform to get the create command to return a model type rather than a ROM::Struct?
I am using ‘commands’ in the repo and creation works, I simply do not understand how to (easily) tell it to return the output as a model type of my choosing.