Hey all, with ActiveStorage coming out very soon I am very quickly finding 
a need for some validations for attachments before storing. Some very quick 
validation helpers would be great for example content type and size would 
be huge wins in protecting an application that is expecting to only allow 
images.

Just a quick example:

class User < ApplicationRecord 
  has_one_attached :avatar
 
  validates :avatar, attachment: { content_types: 'image/*', size: 50 }
end

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to