rom-rb/rom

Rails 7.1 Upgrade Causes map_with To Throw ArgumentError

Closed this issue · 3 comments

Describe the bug

Using rom-core 5.3.1, rails 7.1.3.2

The map_with interface in the relationship.rb file breaks when running rails 7.1+ but works fine on rails 7.0.

Error given:
ArgumentError: wrong number of arguments (given 1, expected 0)

To Reproduce

Create a basic mapping:

  class Mapping < ROM::Repository[:schedules]

    commands :create, update: :by_pk,
      mapper: :mapping_mapper,
      use: :timestamps, plugins_options: {timestamps: {timestamps: %i[created_at updated_at]}}

def by_id id
schedules.map_with(:mapping_mapper).by_pk(id).one
end
end

# run by_id method
mapping.by_id 10 => # argument error

Note .by_pk and .one are not a factor.

Expected behavior

I expect map_with to work as it does when running rails 7.0. I've downgraded and upgraded and the only difference is the rails upgrade.

My environment

  • Affects my production application: NO
  • Ruby version: 3.3.0
  • OS: MacOS Arm

I think the fix for this issue #684 does not work for map_with. undef :with here seems to do the trick

Thanks for reporting, it was fixed in 5.3.2, please check it out

thanks