Catch Ruby errors before your users do. Monitor Ruby production errors in real-time and debug them in minutes, before users notice. Our open source Ruby SDK works with Rails, Sinatra, and more. Use this link and get one month free!

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!

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