Skip to content

Delayed methods with kwargs not working using ruby 3.0.0 #1134

@chbach

Description

@chbach

I recently upgraded our rails app to 6.1 running on ruby 3.0.0. I have now several parts of my code failing when calling methods with keyword arguments (or named parameters) in conjunction with delay. I can reproduce the issue in the rails console:

def my_delayed_method(foo:, bar:) puts foo, bar end
=> :my_delayed_method

my_delayed_method(foo: 'foo', bar: 'bar')
foo
bar
=> nil

delay.my_delayed_method(foo: 'foo', bar: 'bar')
Traceback (most recent call last):
        2: from (irb):4:in `<main>'
        1: from (irb):1:in `my_delayed_method'
ArgumentError (wrong number of arguments (given 1, expected 0; required keywords: foo, bar))

I think this has something to do with the separation of args and kwargs introduced in ruby 2.7. Does delayed_job support ruby 3 and I am missing something? Or is this a compatibility issue?

Rails Version: 6.1.0
Ruby Version: 3.0.0
Delayed Job Version:
delayed_job_active_record (4.1.5)
delayed_job (4.1.9)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions