--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: (ds)
comment: 
- !ruby/struct:SM::Flow::P 
  body: Checks that there are no duplicate values in the database for the given attributes. Pass an array of fields instead of multiple fields to specify that the combination of fields must be unique, instead of that each field should have a unique value.
- !ruby/struct:SM::Flow::P 
  body: "This means that the code:"
- !ruby/struct:SM::Flow::VERB 
  body: "  validates_unique([:column1, :column2])\n"
- !ruby/struct:SM::Flow::P 
  body: validates the grouping of column1 and column2 while
- !ruby/struct:SM::Flow::VERB 
  body: "  validates_unique(:column1, :column2)\n"
- !ruby/struct:SM::Flow::P 
  body: validates them separately.
- !ruby/struct:SM::Flow::P 
  body: "You can pass a block, which is yielded the dataset in which the columns must be unique. So if you are doing a soft delete of records, in which the name must be unique, but only for active records:"
- !ruby/struct:SM::Flow::VERB 
  body: "  validates_unique(:name){|ds| ds.filter(:active)}\n"
- !ruby/struct:SM::Flow::P 
  body: You should also add a unique index in the database, as this suffers from a fairly obvious race condition.
- !ruby/struct:SM::Flow::P 
  body: This validation does not respect the :allow_* options that the other validations accept, since it can deal with a grouping of multiple attributes.
- !ruby/struct:SM::Flow::P 
  body: "Possible Options:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: ":message - The message to use (default: 'is already taken')"
  type: :BULLET
full_name: Sequel::Plugins::ValidationHelpers::InstanceMethods#validates_unique
is_singleton: false
name: validates_unique
params: (*atts) {|ds| ...}
visibility: public
