Attachment_fu, polymorphism and customization

Hi,

I got Image model that has_attachment and belongs_to 2 other models
via polymorphic association.
The problem is that I'd like to customize has_attachment options
(resize image) depending on which model the Image is related to - i.e.
if Image belongs to Article it should be resized using different
settings than if it belongs to Header.

Is there a smart way to do it or do I have to create 2 separate Image
models?

Got it. In Image model:

before_validation :modify_parent_options

protected
def modify_parent_options
  if self.image? && self.parent_id.nil?
    case self.attachment_type
    when 'Article'
      self.attachment_options[:resize_to] = '400x300>'
    end
  end
end