Code what you mean, not what looks right.
This
redirects = []
redirects << params[:redirect_to] || request.referrer
…does not mean this…
redirects = []
redirects << (params[:redirect_to] || request.referrer)
…it means this.
redirects = []
(redirects << params[:redirect_to]) || request.referrer