Open solnic opened 8 years ago
Awesome!!! :heart_eyes:
Twins were designed to work with classic DB "models". They
twin.email = "solnic@trb.to"
which will only change state on the twintwin.sync
to write the data back to the model(s).Would 3. then work via a command? How would we nest commands for nested twins? And: where would we read from existing twins for 1.?
Exciting times!!! :beers: Too bad you couldn't make it to Lviv today, it's warm, sunny, perfect!
If I'm understanding all of the pieces correctly at the moment -- and I may not be -- I suspect that, presently, the block-save syntax of Reform works better for changesets than twin-synching would.
However, Repositories are also meant to be a high-level bridge between your domain objects and your relations, meaning that what you typically get out of a repository is the domain object you're working with ... which, possibly does work better with the twin-syncing.
At a shallow glance right now, then, it looks like the block-save works with changest style commands, while sync works when you've got the repository structured to accept objects to insert/update.
I have been tinkering with migrating forms using the block-style save, and I have some better experience with that ... but the app that I'm working with at the moment predates rom-repository, so I can't say how well those two pieces fit, though there's certainly some conceptual matching.
Also, for that reason, I'd like to make sure that there's a reform linkup that does not depend on rom-repository :)
Hey folks, I'd like to start a discussion about making Reform work with rom-rb repositories. We added support for commands in repositories, so now storing data in rom looks like this:
Furthermore, we added support for changesets, which ie can look like this:
^^^ this stuff will be available next week with rom 2.0 release.
It cannot be any simpler than this, so I think it's a good moment to (finally) have Reform baked by rom repos. As I understand, Reform uses Twins that wrap data and provides sync mechanism for making changes in the underlying db. So I guess that'd be the place where we should integrate our lovely libs ;)
Alternatively we could look into making twins work with commands directly but that's gonna be much harder since repositories automatically build commands, even for nested data.