Found Rails already had a helper that does this.