Searching for abandoned project doesn't work (on postgresql)
Created by: nathansamson
Completed 500 Internal Server Error in 8ms
ActiveRecord::StatementInvalid (PG::Error: ERROR: column "latest_date" does not exist
LINE 1: ...author_id IS NOT NULL) GROUP BY project_id HAVING latest_dat...
^
: SELECT max(created_at) as latest_date, project_id FROM "events" WHERE (author_id IS NOT NULL) GROUP BY project_id HAVING latest_date < '2012-07-24 17:12:10.850124'):
app/models/project.rb:88:in `abandoned'
I think the proper PgSQL way to do this is to modify the HAVING part to 'HAVING MAX(created_at) < ?'.
(using PostgreSQL 8.4, didn't test on 9.X).
Cheers, Nathan