Model classes are not defined at the time the rake task is run: At runtime I think rails autoloading gets them. Just making the hashkeys strings is a simple work-around.