Class: CustomFields::Types::File::UploaderPresenceValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/custom_fields/types/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(document, name) ⇒ UploaderPresenceValidator

Returns a new instance of UploaderPresenceValidator.



66
67
68
69
# File 'lib/custom_fields/types/file.rb', line 66

def initialize(document, name)
  @document = document
  @name = name
end

Instance Method Details

#validateObject



71
72
73
74
75
# File 'lib/custom_fields/types/file.rb', line 71

def validate
  return unless @document.send(@name).blank?

  @document.errors.add(@name, :blank)
end