Skip to content

Commit fd6fc44

Browse files
author
Vidas P
committed
Fix deprecated ActiveRecord errors interface
1 parent 44ede59 commit fd6fc44

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class OwnedByValidator < ActiveModel::EachValidator
22
def validate_each(record, attribute, association)
33
return if association.all? { |s| s[options[:with]] == record[options[:with]] }
4-
record.errors[attribute] << 'must be owned by you'
4+
record.errors.add(attribute, :wrong_owner, message: 'must be owned by you')
55
end
66
end

0 commit comments

Comments
 (0)