igorkasyanchuk/active_storage_validations

[Validator] Add a media_type validator

Open

#277 opened on Nov 7, 2024

 (0 comments) (0 reactions) (0 assignees)Ruby (148 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (1,179 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

We could create a new validator called media_type whose purpose would be to validate the media type (ie the first part of the content_type, application, image, video and other). It could make things easier to write, rather than a content_type: /\Aimage\/.*\z/.

FYI

@mediatype, @subtype = content_type.split('/', 2)

Contributor guide