Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

only check uniqueness if the column changed

  • Loading branch information...
commit 6806ab917c06bd00265fb253a13196cd350d8909 1 parent 123a721
@netskin-ci netskin-ci authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  lib/sequel_sexy_validations/validators/uniqueness.rb
View
2  lib/sequel_sexy_validations/validators/uniqueness.rb
@@ -7,6 +7,8 @@ class Uniqueness
def self.validate(model, attribute, value, options)
return unless value
+ return unless model.changed_columns.include?(attribute)
+
unless model.class.filter(~:id => model.id, attribute => value).empty?
model.errors.add(attribute, "bereits vergeben")
end
Please sign in to comment.
Something went wrong with that request. Please try again.