The Rainbow tells the story of three generations of the Brangwen family, a dynasty of farmers and craftsmen who live in the east Midlands of England, on the borders of Nottinghamshire and Derbyshire. The book spans a period of roughly 65 years from the 1840s to 1905, and shows how the love relationships of the Brangwens change against the backdrop of the increasing industrialisation of Britain. The first central character, Tom Brangwen, is a farmer whose experience of the world does not stretch beyond these two counties; while the last, Ursula, his granddaughter, studies at university and becomes a teacher in the progressively urbanised, capitalist and industrial world.
The book starts with a description of the Brangwen dynasty, then deals with how Tom Brangwen, one of several brothers, fell in love with a Polish refugee and widow, Lydia. The next part of the book deals with Lydia's daughter by her first husband, Anna, and her destructive, battle-riven relationship with her husband, Will, the son of one of Tom's brothers. The last and most extended part of the book, and also probably the most famous, then deals with Will and Anna's daughter, Ursula, and her struggle to find fulfilment for her passionate, spiritual and sensual nature against the confines of the increasingly materialist and conformist society around her. She experiences a same-sex relationship with a teacher, and a passionate but ultimately doomed love affair with Anton Skrebensky, a British soldier of Polish ancestry. At the end of the book, having failed to find her fulfilment in Skrebensky, she has a vision of a rainbow towering over the Earth, promising a new dawn for humanity:
"She saw in the rainbow the earth's new architecture, the old, brittle corruption of houses and factories swept away, the world built up in a living fabric of Truth, fitting to the over-arching heaven."

Question: With who did Ursula have a same sex relationship?
Answer: A teacher.
Alternative answer: A teacher