I have a project that is using paperclip to upload and attach files to
associated models. The schema is thus:
# I want to attach images only (jpg|png|etc) to projects
# I want to attach linked documents (doc|pdf|etc) to pages
has attached_file :image
has attached_file :file
Right now, I have validations for Project:
:message => 'There was no file uploaded!'
:message => 'The file you uploaded does not seem to be a valid
And now I want to add validations for files attached to pages. Only,
how do I go about only calling the validations for files on Pages, while
only calling validations for Images on Projects? ie. if I add
validations for files on pages it will invalidate the records when I am
saving images on projects.
Does that make sense? The way I know I could work around this is to
have two models: AttachedFile and AttachedImage, but that seems not
necessary and would be an extra database table.