class Attachment < ActiveRecord::Base
belongs_to :attachable, :polymorphic => :true
validates_presence_of :width, :height, :if => Proc.new { |attachment| ["Photo", "Logo"].include? attachment.attachable_type }
end
class Asset < ActiveRecord::Base
has_one :attachment, :as => :attachable
end
class Photo < Asset
end
class Logo < Asset
end
class Video < Asset
end