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.



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

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

Instance Method Details

#validateObject



77
78
79
80
81
# File 'lib/custom_fields/types/file.rb', line 77

def validate
  if @document.send(@name).blank?
    @document.errors.add(@name, :blank)
  end
end