Validate Attachment Content Type Paperclip

后端 未结 4 856
生来不讨喜
生来不讨喜 2021-01-06 03:12

Is it possible to enforce a \'content type\' validation in paperclip without enforcing a \'presence\' validation (i.e. allow blanks)? I currently have:

class         


        
4条回答
  •  长发绾君心
    2021-01-06 03:49

    validates_content_type accepts :if => Proc.new{|r| !r.content_type.blank?} in it's options hash, perhaps that would solve your problem.

    http://rdoc.info/github/thoughtbot/paperclip#

提交回复
热议问题