It was the same with the prostitute Rahab. She was put right with God through her actions, by welcoming the Israelite spies and helping them to escape by a different road.