I'm so sorry that that happened to your bird. I'm actually kind of surprised that either attacked the other as they are both prey animals, but I guess rats have the capability to be mean, and birds will defend their cages.
The only time I had a rat in my house was when I first moved in. There were 2 down the basement as it turned out. I found out when I set a bag of garbage in the enclosed back porch to take out when I got home from work. Then I came home to find it all torn open and all over the room. I was like, what the heck?? I knew there was no way a raccoon or something like that could be in here. So I said, geez, I bet there's rats in this house. So I bought traps and sure enough, when I went into the basement to set them, I saw one on the wall.
I have had mice go after the bird cages though. Come crop harvest times, they get run out of the fields by the combines and go into our houses. When we get to those times of the year, I have to set traps and I also clean the bird cages at night and remove their food so there is nothing in the cages to attract the mice. They just want to eat, too. But, I don't want their poop and pee getting on anything and possibly making the birds sick. So I try to make the cages unattractive to them. I even had a shrew get in once. Now that was a weird critter because I had never seen one like it before. At first I thought it was one of those dwarf hamsters, lol! It couldn't climb but it would go under the cages looking for food.