Rails / Postgres: “deve aparecer na cláusula GROUP BY ou ser usado em uma função agregada”

Estou usando esse método:

  def self.lines_price_report(n)
    Income.group('date(filled_at)').having("date(filled_at) > ?", Date.today - n).sum(:lines_price)
  end

Estou recebendo este erro no Heroku:

PG::Error: ERROR:  column "incomes.filled_at" must appear in the GROUP BY clause 
or be used in an aggregate function

Como posso consertar isso? Obrigado.

Consulta executada:

SELECT SUM("incomes"."lines_price") AS sum_lines_price, date(filled_at)
AS date_filled_at FROM "incomes"
HAVING (date(filled_at) > '2012-12-04')
GROUP BY date(filled_at) ORDER BY filled_at ASC

Resultado esperado

[["2012-12-04", SUM_FOR_DATE], ["2012-12-05", SUM_FOR_DATE], ...]

questionAnswers(3)

yourAnswerToTheQuestion