fix getting the type when using activerecord models