As a result of a vow made to God for his protection and favour, he, by his will dated 11 April 1707, devoted one half of his estate to fund a charity school for 24 boys: "sons of parents who were of good report and reduced to poverty".
Hugh Rainey died in 1707 and the task of building the school fell to his only child, Elizabeth, and her husband.
The school motto, taken from the Salters Company, is Sal Sapit Omnia, translated as Salt flavours all.
There is a heavy emphasis on extra-curricular activity, including drama, public-speaking, choirs, orchestras, and Scripture Union.
More than 100 pupils take part in the Duke of Edinburgh Award scheme: 25 raised £35,000 for Gold Expedition in Kenya, with half of the money given to a charitable organisation that funds primary education in Nairobi.
There has been a recent emphasis by the sixth form on charity fundraising: large amounts have been raised for tsunami appeal, Leukaemia Research, and Cystic Fibrosis Trust.