Fixed UNION syntax for MySQL

MySQL doesn't support the previous syntax.
This commit is contained in:
Yorick Peterse 2015-10-29 13:33:20 +01:00
parent 24c8f42278
commit bba46623c2
1 changed files with 2 additions and 2 deletions

View File

@ -238,9 +238,9 @@ class User < ActiveRecord::Base
# Arel doesn't allow for chaining operations on union nodes, thus we have
# to write this query by hand. See the following issue for more info:
# https://github.com/rails/arel/issues/98.
sql = '(SELECT * FROM users WHERE email = :email
sql = '(SELECT * FROM users WHERE email = :email)
UNION
SELECT users.*
(SELECT users.*
FROM emails
INNER JOIN users ON users.id = emails.user_id
WHERE emails.email = :email)