Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

examples for validates_uniqueness_of

  • Loading branch information...
commit 08566b3c9e8a84ea0c8f4c22bf19fe6089f5352f 1 parent 20d7bc5
@jmhodges jmhodges authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/sequel_model/validations.rb
View
6 lib/sequel_model/validations.rb
@@ -323,6 +323,12 @@ def self.validates_presence_of(*atts)
# fields to specify that the combination of fields must be unique,
# instead of that each field should have a unique value.
#
+ # This means that the code:
+ # validates_uniqueness_of([:column1, :column2])
+ # validates the grouping of column1 and column2 while
+ # validates_uniqueness_of(:column1, :column2)
+ # validates them separately.
+
# You should also add a unique index in the
# database, as this suffers from a fairly obvious race condition.
#
Please sign in to comment.
Something went wrong with that request. Please try again.