Keyword arguments in model instance methods? #2021
destroytoday
started this conversation in
General
Replies: 1 comment 1 reply
-
There must be more code than you are showing (such a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! Been using Sequel in my app for over 9 years now and really appreciate all the work that went into it.
I’m in the process of upgrading from Ruby 2.7 to 3.1 and in doing so, I hit an issue with how Sequel models handle keyword arguments. I’m on the latest Sequel version, but narrowed it down to keyword arguments being passed to a model’s method being treated like a single argument hash, so I get the classic
wrong number of arguments (given 1, expected 0)
Here’s what the code sorta looks like:
In Ruby 2.7, this worked no problem, and I assumed by updating the gem that it would work with the latest Ruby 3 keyword arguments, but I now get this error. If I change it to
def deliver(options)
, I can reference them likeoptions[:contacts]
, but I’d much rather be able to reference them directly if possible.Any pointers would be incredibly welcome!
Beta Was this translation helpful? Give feedback.
All reactions