Closed lostie closed 2 years ago
@adzap I believe 6.0.0.beta1 version has introduced a breaking change:
# ArgumentError: # wrong number of arguments (given 3, expected 1..2) lib/ruby/gems/3.0.0/gems/activemodel-6.1.4.1/lib/active_model/errors.rb:404:in `add' lib/ruby/gems/3.0.0/gems/validates_timeliness-6.0.0.beta1/lib/validates_timeliness/validator.rb:89:in `add_error' lib/ruby/gems/3.0.0/gems/validates_timeliness-6.0.0.beta1/lib/validates_timeliness/validator.rb:80:in `rescue in block in validate_restrictions' lib/ruby/gems/3.0.0/gems/validates_timeliness-6.0.0.beta1/lib/validates_timeliness/validator.rb:72:in `block in validate_restrictions' lib/ruby/gems/3.0.0/gems/validates_timeliness-6.0.0.beta1/lib/validates_timeliness/validator.rb:71:in `each' lib/ruby/gems/3.0.0/gems/validates_timeliness-6.0.0.beta1/lib/validates_timeliness/validator.rb:71:in `validate_restrictions' lib/ruby/gems/3.0.0/gems/validates_timeliness-6.0.0.beta1/lib/validates_timeliness/validator.rb:67:in `validate_each'
The options passed through ActiveModel's add method needs to be provided with a double splat (**).
options
add
**
record.errors.add(attr_name, message, **message_options)
Is this specific Ruby 3?
It is. Basically where you used to be able to pass a hash as last keyword args you now have explicitly splat them.
https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
@adzap I believe 6.0.0.beta1 version has introduced a breaking change:
The
options
passed through ActiveModel'sadd
method needs to be provided with a double splat (**
).