-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 7.3.0
-
Component/s: Validations
-
None
-
Environment:Ruby 3.0.0
I am utilizing the master branch for the Rails 6.1 support and I've come across an issue when an ActiveModel validation attempts to add an error:
wrong number of arguments (given 3, expected 1..2)
On line 45 of mongoid/validatable/presence.rb (but it affects all validatables) it attempts to add the error to the document as such:
document.errors.add(attribute, :blank, options) if not_present?(value)
For me, attribute is :host and options is just an empty hash. It looks like Rails 6.1 now splats this last argument after this change:
I think for each of these, we'll need to splat them ourselves first to avoid this error.
>> document.errors.add(:host, :blank, {}) ArgumentError: wrong number of arguments (given 3, expected 1..2) from (eval):1:in `validate_each' >> document.errors.add(:host, :blank, **{}) => #<ActiveModel::Error attribute=host, type=blank, options={}>
- is duplicated by
-
MONGOID-5053 Validation Error not working
- Closed