Commit bba46623 authored by Yorick Peterse's avatar Yorick Peterse

Fixed UNION syntax for MySQL

MySQL doesn't support the previous syntax.
parent 24c8f422
...@@ -238,9 +238,9 @@ class User < ActiveRecord::Base ...@@ -238,9 +238,9 @@ class User < ActiveRecord::Base
# Arel doesn't allow for chaining operations on union nodes, thus we have # 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: # to write this query by hand. See the following issue for more info:
# https://github.com/rails/arel/issues/98. # https://github.com/rails/arel/issues/98.
sql = '(SELECT * FROM users WHERE email = :email sql = '(SELECT * FROM users WHERE email = :email)
UNION UNION
SELECT users.* (SELECT users.*
FROM emails FROM emails
INNER JOIN users ON users.id = emails.user_id INNER JOIN users ON users.id = emails.user_id
WHERE emails.email = :email) WHERE emails.email = :email)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment