Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 7.1 Upgrade Causes map_with To Throw ArgumentError #691

Closed
bendangelo opened this issue Apr 24, 2024 · 3 comments
Closed

Rails 7.1 Upgrade Causes map_with To Throw ArgumentError #691

bendangelo opened this issue Apr 24, 2024 · 3 comments

Comments

@bendangelo
Copy link

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
@hellvinz
Copy link

hellvinz commented May 4, 2024

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

flash-gordon added a commit that referenced this issue May 6, 2024
Fix using .with on composite relations (fix #691)
@flash-gordon
Copy link
Member

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

@bendangelo
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants