Skip to content

5.0 Upgrade Guide

Piotr Solnica edited this page Apr 24, 2019 · 3 revisions

Upgrading 4.x => 5.0

MRI >= 2.4 only

We've dropped support for MRI < 2.4, which obviously means that the prerequisite is to upgrade your Ruby, if you're on < 2.4.

Gemfile

In 5.0 rom-mapper is gone. If you have it in your Gemfile, simply remove it.

If you happen to require rom-mapper manually, simply do:

# 4.x
require 'rom-mapper'

# 5.x
require 'rom/mapper'

Repository#aggregate is gone

If you use Repository#aggregate change it to Relation#combine, ie:

# 4.x
class UserRepo < ROM::Repository[:users]
  def get(id)
    aggregate(:account).by_pk(id).one
  end
end

# 5.x
class UserRepo < ROM::Repository[:users]
  def get(id)
    users.combine(:account).by_pk(id).one
  end
end

Setting attribute aliases is no longer part of type meta

Information about aliases is now stored within the attribute object itself. To upgrade:

# 4.x
attribute :username, Types::String.meta(alias: :name)

# 5.x
attribute :username, Types::String, alias: :name

Types::Int renamed to Types::Integer

All occurences of Types::Int must be renamed to Types::Integer.

More information

Please go through the changelogs too:

If you need help, ask a question either on our forum or our community chat.