-
-
Notifications
You must be signed in to change notification settings - Fork 162
2.0 Upgrade Guide
There were a couple of breaking changes in 2.0.0 and API deprecations in rom-sql 0.8.0.
We dropped support for MRI 2.0.0 as it caused too much friction in the development; however, if you're stuck on MRI 2.0.0 and would like to use rom-rb, please let us know, it'll be easy to add the support back.
If you rely on global ROM.env it's time to stop, rom-rails still provides that but it's gone in rom core gem. Check out rom-rails-skeleton which uses dry-container to manage rom components. You may also want to see how this is done in a more advanced fashion in Icelab's berg project if you'd like to see a non-rails example.
If you use custom command graphs, you will notice that now they return either Hash or Array<Hash>, in 1.0.0 they returned Relation::Loaded which was an inconsistent behavior, that's why it was changed.
To upgrade, simply remove calls to #one or #to_a on results from command graphs, ie:
# in 1.0.0:
one_result_command_graph.call(data).one
many_result_command_graph.call(data).to_a
# in 2.0.0
one_result_command_graph.call(data)
many_result_command_graph.call(data)If you use validator setting in custom command classes, please move this to the application layer and validate data prior sending them to command. We recommend using dry-validation and for complex form handling check out reform.
This feature is deprecated as we're moving to repository changesets instead. See the user docs for more information