The Ray Gun is actually quite easy to get and an incredibly powerful weapon, it's also a random event so it may not show right away for everyone. The quickest way to find it is to travel to Overland Station since it's located a few feet away from it.
Once there head East and you'll come across this massive crashed ship. Once taking a look at the fancy ship head left towards these hills and there should be a steep path down with a cave at the end of it.
Just walk down this path and enter the cave, be careful as there's an alien in there. It's an easy kill and just loot his body for the Ray Gun along with a good stack of ammo. It really is that simple, check the images below for assistance and if you have any questions let me know!
The location of the Fallout 4: Ray Gun
Check out our Fallout 4 Review
Fallout 4 Settlement Guide