Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Can't pass arguments on events with bangs in Ruby 3.0 #834

@endangurura

Description

@endangurura

I'm working on upgrading an application from Rails 5.2 to latest.
Currently running:

rails 6.1
ruby 3.0
aasm 5.5 (I tried 5.4 too, same results)

When I try to call events with bangs, I get an ArgumentError wrong number of arguments (given 1, expected 0)

event :accept, after: :send_accept_notification do
  transitions from: :pending, to: :accepted, after: after: proc { |user| check_accept_permission(user) }
end

call

job = Job.new
job.accept!(current_user)  # => raises ArgumentError
job.accept(current_user)  # => works but as expected no persistence

With Ruby 2.7 the ArgumentError is not raised

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