Read more

Validate attachment presence using paperclip

Martin Straub
April 19, 2012Software engineer at makandra GmbH

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

has_attached_file :image
validates_attachment_presence :image
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
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 by Martin Straub to makandra dev (2012-04-19 17:12)