Skip to content

Commit 3b938b7

Browse files
committed
Support Rails 6.1
1 parent 4e8e9da commit 3b938b7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/dynamoid/validations.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ def validates_presence_of(*attr_names)
5050
class PresenceValidator < ActiveModel::EachValidator
5151
# Validate the record for the record and value.
5252
def validate_each(record, attr_name, value)
53-
record.errors.add(attr_name, :blank, options) if not_present?(value)
53+
# Use keyword argument `options` because it was a Hash in Rails < 6.1
54+
# and became a keyword argument in 6.1. This way it works in both
55+
# cases.
56+
record.errors.add(attr_name, :blank, **options) if not_present?(value)
5457
end
5558

5659
private

0 commit comments

Comments
 (0)