. . . "May not solve your problem, but: if type field is not being used for STI (Single Table Inheritance), I suggest you name it something other than type." .