Created
December 27, 2011 20:06
-
-
Save weyus/1524987 to your computer and use it in GitHub Desktop.
SQL output of ActiveRelation or Arel query that I would like
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Arel is unfortunately needlessly complex given that the outer query conditions don't need to use the alias in the raw SQL.
The alias is really only needed on the condition in the correlated subquery.
But you have to use mr_alias in the outer query or you get this Postgres error - 'PGError: ERROR: invalid reference to FROM-clause entry for table "monitor_requests"' Lame.