gregbell/active_admin — pull request #1062 by brendandixon (2012-02-22 20:49:17+00:00)
Title: Replace ARel "exists?" with "count >= 1" due to ARel bugs against SQL Server

ARel generates invalid SQL for SQL Server from the statement:

collection.reorder('').limit(1).exists?

If changed, to the equally performant form:

collection.reorder('').limit(1).count >= 1

The SQL is correct.

While I understand this is a bug in ARel (or the activerecord-sqlserver-connector), this seems so innocuous and helpful, I thought I'd ask.

Thank you!