Calling permission.save will execute all the callbacks including validators and maybe a validator is preventing the record to be saved. To skip validators you can use update_column instead of save
permission.update_column(:name, permission.action << ", " << target_name)
Also I would recommend you a couple of tips:
- Use Auth::Permission.find_each instead of Auth::Permission.all.each (this loads all the records at once in memory)
- Try to update the permission in a rake task and use only the migration to modify the table (it is the recommended good practice way)