Rails - Paperclip validating attachment size when it shouldn't be?

前端 未结 3 819
迷失自我
迷失自我 2021-02-05 17:39

I\'ve got a rails model using Paperclip that looks like this:

  has_attached_file :image, :styles => { :normal => [\'857x392#\', :png] },
                          


        
3条回答
  •  离开以前
    2021-02-05 18:07

    validates_attachment_size :image, :less_than => 25.megabytes, 
                              :unless => Proc.new {|m| m[:image].nil?}
    

    works perfectly for me

提交回复
热议问题