Does cannabis affect cycling performance? Some of my friends like to smoke (using both traditional methods and vaporizers that produce no "smoke") or eat edibles before rides, they say it makes it more enjoyable.  I always wonder if it affects their performance, insofar as they fatigue faster, have less endurance, make less power, etc.

They claim it doesn't.  A few have said they are actually better while medicated, for various reasons, like any pain they may be having is numbed or they feel that they can just crank away forever.  I'm not so sure. I usually say "well, it probably just feels that way" - I doubt there is any benefit, but I could be wrong.  

Furthermore, for an experienced rider, could it be said that it is dangerous to medicate and ride?

Have there been any studies done or any empirical research that points to a decline in performance and/or increased safety risk? e.g. getting hit by a car.
Are you asking about the immediate effects while high or long-term effects?

I can't find any unbiased, well-cited sources except for one from the British Journal of Sports Medicine which basically says that doctors should try to keep athletes from using cannabis due to its possible dangers. However, some sources (of unknown quality) claim that it may help with some sports due to e.g. its ability to help people get into a pseudo-meditative state (which assumedly helps with e.g. long-distance running). Others claim that its ability to lessen the perception of pain may be of benefit in some sports (e.g. in combat sports).

However, cannabis use has been more or less uncontroversially proven to slow down nervous-system response (c.f. "Cannabis use and cognitive dysfunction") and so it can be dangerous to use when reflexes are necessary for one's safety (i.e. such as when riding a bicycle). Moreover, smoking cannabis is still smoking --- the long-term health consequences of which are hard to overstate.