So bring up a warrior, spearman, swordsman, horseman, etc. to do the actual attack.
Pretty sure horseman doesn't fall under the 'melee' category, and thus doesn't receive the bonus. Melee, light cav, and heavy cav are all separate categories.
To my knowledge, if the city has a wall your melee units will do reduced damage to it. Having the Battering ram will allow your melee units to do full damage to the walls.
If a city did not have walls what would one use a battering ram for apart from a vantage point to watch the slaughter.
ThisBattering ram is a support unit -- it cannot attack anything. It provides a bonus to attacking melee units (attack walls with no penalty). So bring up a warrior, spearman, swordsman, horseman, etc. to do the actual attack.