Class: DSNode::DSResource::RecognizedFileTypeValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/ds_node/ds_resource.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attr, values) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/ds_node/ds_resource.rb', line 9

def validate_each record, attr, values
  [values].flatten.each do |value|
    if value and !image?(value) and !video?(value)
      record.errors.add attr, "must be a recognized file type."
      return
    end
  end
end