Validate attachment presence using paperclip

Posted . Visible to the public.

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

has_attached_file :image
validates_attachment_presence :image

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.

Martin Straub
Last edit
Keywords
validates_presence_of
License
Source code in this card is licensed under the MIT License.
Posted by Martin Straub to makandra dev (2012-04-19 15:12)