Just upgraded to Rails 3.1, ran my test and found this issue:
class Trade < ActiveRecord::Base
stale_trades = Trade.count('transaction_trades.id',
:include => :transaction_trades,
:group => 'trades.id')
:having => "count_transaction_trades_id =
Earlier this used to work perfectly, now I get this:
Mysql2::Error: Unknown column 'transaction_trades.id' in 'field list':
SELECT COUNT(transaction_trades.id) AS count_transaction_trades_id,
trades.id AS trades_id FROM `trades` GROUP BY trades.id
What puzzles me is that no LEFT OUTER JOIN on transaction_trades is
present in generated SQL - that's why things broke.
Any hints what's wrong here? Why is :include => :transaction_trades
seems to be ignored?