Class: CustomFields::Types::File::UploaderPresenceValidator
- Inherits:
-
Object
- Object
- CustomFields::Types::File::UploaderPresenceValidator
- Defined in:
- lib/custom_fields/types/file.rb
Instance Method Summary collapse
-
#initialize(document, name) ⇒ UploaderPresenceValidator
constructor
A new instance of UploaderPresenceValidator.
- #validate ⇒ Object
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
#validate ⇒ Object
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 |