RubyFlow The Ruby and Rails community linklog

Adding an Attachment Presence Validator to Active Storage

If you’re using Active Storage, you should know that it does not (yet) provide a way to validate the presence of an attachment. Unlike Paperclip or the other popular file upload gems, there’s no validates_attachment_presence method you can use. Luckily it’s pretty easy to roll this out ourselves. I’ll share the custom validator code that I use to add in the missing validator in this post: http://www.carlosramireziii.com/adding-an-attachment-validator-to-active-storage.html

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in