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

Fix command(:create, result: :many) for combines #686

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dgollahon
Copy link

  • In ruby 3.x the result: :many will get forwarded incorrectly if there is a combine. That is, something like relation.command(:create, result: :many) will work but relation.combine(:child_relation).command(:create, result: :many) will raise ArgumentError: wrong number of arguments (given 2, expected 1). This fixes is it (I have tested by doing the following on my codebase ROM::Relation::Combined.__send__(:ruby2_keywords, :command)).

- In ruby 3.x the `result: :many` will get forwarded incorrectly if there is a `combine`. That is, something like `relation.command(:create, result: :many)` will work but `relation.combine(:child_relation).command(:create, result: :many)` will raise `ArgumentError: wrong number of arguments (given 2, expected 1)`. This fixes is it (I have tested by doing the following on my codebase `ROM::Relation::Combined.__send__(:ruby2_keywords, :command)`).
@dgollahon
Copy link
Author

NOTE: I have not added any tests here because it was too much effort and I had too little time to figure out how to set up a local environment that worked. I would appreciate either someone else adding a test or pointers for getting set up.

@flash-gordon
Copy link
Member

I think we can drop ruby 2.x safely

@katafrakt
Copy link

I see 2.x was already dropped from rom-sql. So should we do the same here? I can create the PR if needed.

@dgollahon
Copy link
Author

I see 2.x was already dropped from rom-sql. So should we do the same here? I can create the PR if needed.

To be clear, this isn't directly an issue of 2.x support. This doesn't work on 3.x, using 2.x style keywords happens to fix it.

@solnic
Copy link
Member

solnic commented Feb 1, 2024

Thanks for the PR! So you're saying that without this, it's broken under 3.x?

@solnic
Copy link
Member

solnic commented Feb 1, 2024

I think we can drop ruby 2.x safely

Yes let's do this

@dgollahon
Copy link
Author

Thanks for the PR! So you're saying that without this, it's broken under 3.x?

Correct, when combined with #combine.

@solnic
Copy link
Member

solnic commented Feb 6, 2024

How about we just ditch 2.x and fix signatures to be command(type, **opts)?

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

Successfully merging this pull request may close these issues.

5 participants