Skip to content

Commit

Permalink
Fix deprecated ActiveRecord errors interface
Browse files Browse the repository at this point in the history
  • Loading branch information
vidas committed Mar 27, 2023
1 parent 44ede59 commit fd6fc44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/validators/owned_by_validator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class OwnedByValidator < ActiveModel::EachValidator
def validate_each(record, attribute, association)
return if association.all? { |s| s[options[:with]] == record[options[:with]] }
record.errors[attribute] << 'must be owned by you'
record.errors.add(attribute, :wrong_owner, message: 'must be owned by you')
end
end

0 comments on commit fd6fc44

Please sign in to comment.