When does light behave as a ray?
Light ray is defined as the path along which light travels. Hence, a ray is geometrical concept.
Now , precise definition of wave: A wave is a disturbance which varies from time to time and from point to point. In case of light wave mutually perpendicular electric and magnetic field vectors are oscillating , that is they are changing with space and time as such disturbance advances in the direction perpendicular to the plane formed by electric and magnetic fields. This is why we call light waves as electromagnetic waves.
Light has dual nature . In some circumstances such as lnterference of light, it behaves as waves. We can explain interference pattern by superposition of light waves. While in explaining energy distribution in black body radiation,photoelectric effect, Compton scattering we have to have particle nature of light. These particles are known as photons. When light is emitted and absorbed or in general interacting with matter, it is behaving as made up of photons which are quanta of light energy. Photons have all the properties of particles except rest mass. We know that in quantum mechanics particles are represented by their representative wave functions . These wave functions contain all informations of the particles.Wave functions are WINDOWS through which we can view the world at atomic and sub atomic level.
The famous double slit experiment shows that light waves are probability waves . Their absolute square computed at some point gives the probability of finding the photon in unit volume at that point.