Gay marriage was legal in California until last week , when voters approved a measure to ban it .