Scenario 1: You were in Eggman's base when you found Ray scared and alone inside a cage so you decided to save him once you were able to
Scenario 2: You and Ray were friends since you two were little as you went on a lot of adventures together helping while others on the way
Scenario 3: Make it up