Rails - Paperclip validating attachment size when it shouldn't be?
activerecord, paperclip, ruby, ruby-on-rails, ruby-on-rails-plugins
Solution
validates_attachment_size :image, :in => 0.megabytes..2.megabytes
works now
Problem
I've got a rails model using Paperclip that looks like this: ``` has_attached_file :image, :styles => { :normal => ['857x392#', :png] }, :url => '/assets/pages/:id/:basename.:extension', :path => ':rails_root/public/assets/pages/:id/:basename.:extension' validates_attachment_size :image, :less_than => 2.megabytes ``` When attempting to create a record of this model without an attachment to upload, the validation error is returned: There were problems with the following fields: ``` * Image file size file size must be between 0 and 2097152 bytes. ``` I've tried passing both :allow_blank => true and :allow_nil => true after the validation statement in the model, but neither have worked. How can I allow the :image parameter to be blank?