Fork paperclip validations depending on associated model

Hi all,

I have a project that is using paperclip to upload and attach files to
associated models. The schema is thus:

Class Project
has_many :attached_files

I want to attach images only (jpg|png|etc) to projects


Class Page
has_many :attached_files

I want to attach linked documents (doc|pdf|etc) to pages


Class Attachedfile
has attached_file :image
has attached_file :file

Right now, I have validations for Project:

validates_attachment_presence :image,
:message => ‘There was no file uploaded!’
validates_attachment_thumbnails :image,
: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.