Addind direct query to handle known bug in rails