Commit ccb58e659f4a4401b150d05ef5fd8fee9435d256
1 parent
02e15f4c
Exists in
colab
and in
4 other branches
Project validation fixed, so it doesn't break the other tests.
It's there are still missing
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
app/models/project.rb
app/models/validators/kalibro_uniqueness_validator.rb
... | ... | @@ -2,7 +2,8 @@ class KalibroUniquenessValidator < ActiveModel::EachValidator |
2 | 2 | def validate_each(record, attribute, value) |
3 | 3 | record.class.all.each do |entity| |
4 | 4 | if entity.send(attribute) == value |
5 | - record.kalibro_errors << "There's already a #{record.class} with this #{attribute}! Please, choose another one." | |
5 | + record.errors[:attribute] << "There's already a #{record.class} with #{attribute} #{value}! Please, choose another one." | |
6 | + break | |
6 | 7 | end |
7 | 8 | end |
8 | 9 | end | ... | ... |