What happens when an Immovable Rod is activated while in a vehicle?

The Red Bandits have boarded the train, hidden among the other passengers. They wait an hour or two – to be sure the train is far from any city – then, on the boss’s signal, they all pull out their weapons. The boss shouts, “Everybody down! This is a robbery!”

As they thieves rush from car to car, robbing each passenger of jewelry and loose coin, our adventurers realize they need to do something or lose their recently-won loot. The rogue pulls out an Immovable Rod, places it against the car’s door to bar it shut, and presses the button.

What happens?

Does the Rod use the ground (or the Prime Material Plane) as its reference frame for “unmoving”? Does the Rod stay still relative to the train car? Does it stay in motion in a straight line, which works fine (albeit with some shaking) until the train tracks turn?

Obviously this ultimately falls to DM discretion, but is there any rule or description that leans toward a particular answer? (I’ve tagged it for 5e, but I’ll take an answer from any edition.)