Class: Pageflow::ThemeCustomizationFile::AttachmentContentTypeValidator Private

Inherits:
Paperclip::Validators::AttachmentContentTypeValidator
  • Object
show all
Defined in:
app/models/pageflow/theme_customization_file.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Paperclip requires a content type validator for security reasons. Sub-classes are fine, though. The original validator does not provide a way to dynamically determine the permitted content types.

Since:

  • 15.7

Instance Method Summary collapse

Instance Method Details

#check_validity!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Override to not require :content_type option.

Since:

  • 15.7



27
28
29
# File 'app/models/pageflow/theme_customization_file.rb', line 27

def check_validity!
  true
end

#validate_whitelist(record, attribute, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 15.7



21
22
23
24
# File 'app/models/pageflow/theme_customization_file.rb', line 21

def validate_whitelist(record, attribute, value)
  return if value =~ record.options_from_entry_type[:content_type]
  record.errors.add(attribute, :invalid)
end