A few submarines bit it by rams though, either accidentally or deliberately.Quoted for truth. If I recall correctly, only one ship was ever sunk with a ram. Accidently.
If you can slow down torpedo development, you might get a situation where small boat ram battleships and the like, equipped with spar torpedoes (hanging over the bows, rather than affixed to them). Even that though would be rather situational and only tried by desperate nations.