Repaying your ex-boyfriend was the right thing to do. She was your friend and as you said, he wouldn't have invited her along on his own. In all honesty though, I doubt you will ever get your money back. There are too people in this world who have learned that they can just avoid their friends/family long enough and the debt isn't an issue for them.
My rule is never to loan money to anyone. I learned it in 7th grade when a couple of kids would borrow money to buy ice cream and wouldn't repay it. When confronted about the status of their repayment when they asked to borrow another dollar, they would simply say, "but I didn't plan to pay you back and I don't have any money, but I want something else for lunch". That was enough for me. It taught me that they only came to me because they thought I had money and would be willing to help them treat themselves. From that moment on, I decided that I wouldn't be loaning money to anyone because my money is used to treat me and my family only.
You were kind to your friend, but remember that kindness takes many forms and lots of those forms don't involve using your money to aid her. Your money is your's alone and nobody ever has a right to claim the use of it for themselves.