RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Validating the Content-Type of Active Storage Attachments

Full validation support for Active Storage attachments won’t be arriving until Rails 6. Until then you’ll need to write your own custom validators to add this missing functionality. Last time I showed you how to write an attachment presence validator. Next I’ll share a validator which can restrict the content-type of your attachments. Drop this bit of code and its accompanying RSpec matcher into your project to tide you over until the next Rails release.
http://www.carlosramireziii.com/validating-the-content-type-of-active-storage-attachments.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