Fix for when attachment is set on a parent class (eg ActiveRecords STI)