Class: Polyblock::Validators::PolyblockPresenceValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/polyblock/validators/polyblock_presence_validator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.helper_method_nameObject



13
14
15
# File 'lib/polyblock/validators/polyblock_presence_validator.rb', line 13

def self.helper_method_name
  :validates_polyblock_presence
end

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



7
8
9
10
11
# File 'lib/polyblock/validators/polyblock_presence_validator.rb', line 7

def validate_each(record, attribute, value)
  unless record.send(attribute).present?
    record.errors.add(attribute, :blank, options)
  end
end