Read more

Validate attachment presence using paperclip

Deleted user #6
April 19, 2012Software engineer

Make sure you call the methods in the following order and not vice versa:

has_attached_file :image
validates_attachment_presence :image
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

Validation with condition works fine, too:

validates_attachment_presence :image, :if => :method

This is because validates_attachment_presence is only available after saying has_attached_file.

Posted to makandra dev (2012-04-19 17:12)