Paperclip Giving Required field error -


in project have form in there file field upload file , using paperclip gem , add validation 'validates_attachment_content_type' when submit form without file selected gives error of 'validates_attachment_content_type', should not give error not add validation 'validates_attachment_presence'. confused giving error of 'validates_attachment_content_type' when submit form without file uploaded.

after googling same got answer prob have add :allow_nil => true in validation

for eg.

validates_attachment_content_type :logo, :content_type => ['image/jpeg','image/png','image /jpg','image/gif'], :message=>"image file must of .jpeg,'.jpg', '.gif' or .png type",:allow_nil => true


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -