The rails plugin paperclip supports validations at the model such as:
validates_attachment_size
The only problem is that using this validation seems to force the validation of an actual attachment, where sometimes there may not be one.
If I'm validating the following, what condition :if could I use to ignore the validation if there is not :document present? (meaning the user submitted the parent object without a document attached).
validates_attachment_size :document, :less_than => 5.megabytes, :if => ???
The parent object is a :note, so in the note.rb file I have:
has_attached_file :document
RDocs: dev.thoughtbot.com/paperclip/