Tried to adapt the restore script to Rails 3.2