Module: Mailchecker::Validations

Defined in:
lib/mailchecker.rb

Class Method Summary collapse

Class Method Details

.mailchecker(*attr_names) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/mailchecker.rb', line 54

def self.mailchecker *attr_names
  options = { on: :save, allow_nil: false, allow_blank: false }
  options.update attr_names.pop if attr_names.last.is_a? Hash

  validates_each(attr_names, options) do |record, attr_name, value|
    Mailchecker.record_validation record, attr_name, value
  end
end