Skip to content

0.9 Upgrade Guide

Piotr Solnica edited this page Sep 18, 2017 · 1 revision

Upgrading to 0.9.0

If you are using rom via rom-rails, rom-lotus or rom-roda - no need to change anything; however, if you are using rom standalone and handle setup process yourself, you need to enabled auto_registration plugin prior running the setup. This will ensure that components will be registered automatically just like before 0.9.0.

To enable auto_registration plugin simply run:

ROM.use :auto_registration

# your setup code

Make sure this is called just once.

If you prefer to register components manually, which is useful for cases where you want to encapsulate rom components in a shared library that shouldn't require setup process, you can skip enabling auto-registration and then in client code which uses rom components register them manually:

# let's say your lib provides this relation component
class SomeLib::Users < ROM::Relation[:some_adapter]
  dataset :users
end

# then client code which uses your lib can do this
rom = ROM::Environment.new

rom.setup(:some_adapter, some: :options)

rom.register_relation(SomeLib::Users)

container = env.finalize.env

container.relation(:users) # returns relation object
Clone this wiki locally