in february, 1831 ramsay was promoted captain, in which grade he was to serve for 26 years while commanding several arsenals and during his subsequent service in the mexican–american war. he won a brevet majority for gallantry in the mexican war and served as chief ordnance officer of the army of occupation commanded by major general zachary taylor. he returned to peacetime responsibilities as the commandant of several arsenals until assigned to serve on the ordnance board on the eve of the civil war. with the coming of that conflict, his rise, heretofore glacial, was relatively meteoric. he was made a major in april 1861, a lieutenant colonel in august of that same year, and a colonel in june 1863.