Dancing On The Rails
Doing something extremely stupid or reckless usually for the amusement of others or for the thrill of doing something daring. Often occurs as a result of peer pressure.

The expression originates from the urban myth(?) of someone dancing on the railroad tracks and paying for the foolish mistake with their life.
Dana: Look at Jimmy. He’s dancing on the rails again

Bill: What an idiot! He’ll get hurt if he doesn’t stop it!