I’ve just attempted an upgrade from Rails 2.02 to 2.1 and I’m seeing
dozens of unit test failures with errors like this:
ActionView::TemplateError: Mysql::Error: Not unique table/alias:
‘clients’: SELECT count(DISTINCT
projects.id) AS count_all FROM
projects LEFT OUTER JOIN
projects.client_id INNER JOIN clients ON projects.client_id =
clients.id WHERE ((
clients.company_id = 1) AND
((projects.status = ‘Active’)))
This is invalid SQL which Rails has generated – it seems to be the
‘INNER JOIN clients ON projects.client_id = clients.id’ which is
causing the problem, but I can’t figure out why this is happening.
Has anyone else experienced a similar problem with Rails 2.1, or can
anyone suggest what new features of 2.1 might be responsible for
introducing these errors?