Method: NoBrainer::Document::Validation::Uniqueness::UniquenessValidator#initialize

Defined in:
lib/no_brainer/document/validation/uniqueness.rb

#initialize(options = {}) ⇒ UniquenessValidator

Returns a new instance of UniquenessValidator.



59
60
61
62
63
64
65
66
67
# File 'lib/no_brainer/document/validation/uniqueness.rb', line 59

def initialize(options={})
  super
  self.model = options[:class]
  self.scope = [*options[:scope]].map(&:to_sym)

  model.subclass_tree.each do |subclass|
    subclass.unique_validators << self
  end
end