Rubyfatt icon indicating copy to clipboard operation
Rubyfatt copied to clipboard

Errore nella home page con PostgreSQL

Open tommyblue opened this issue 10 years ago • 0 comments

Nel fare il nuovo sito demo ho usato Postgres. Al login viene fuori questo errore. Nel db c'è soltanto l'utente demo, non altro @duncanita riesci a darci un'occhiata?

ActionView::Template::Error (PG::GroupingError: ERROR:  column "invoices.date" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...s.date)  ORDER BY month_number, EXTRACT(YEAR FROM invoices.d...
                                                             ^
: SELECT EXTRACT(MONTH FROM invoices.date) AS month_number, SUM(slips.rate) AS month_income FROM "invoices" INNER JOIN "slips" ON "slips"."invoice_id" = "invoices"."id" INNER JOIN "customers" "customers_invoices" ON "customers_invoices"."id" = "invoices"."customer_id" INNER JOIN "customers" ON "invoices"."customer_id" = "customers"."id" WHERE "customers"."user_id" = $1 AND (EXTRACT(YEAR FROM invoices.date) = 2013 AND invoices.paid = 't') GROUP BY EXTRACT(MONTH FROM invoices.date)  ORDER BY month_number, EXTRACT(YEAR FROM invoices.date), invoices.number, invoices.id):
    1: <%
    2:   invoices = []
    3:   @this_year.each do |invoice|
    4:     invoices << "{'x' : #{invoice.month_number}, 'y': #{invoice.month_income}}"
    5:   end
    6:   invoices = ["{'x': 0, 'y': 0}"] if invoices.size == 0
  app/views/dashboard/_incomes_this_year.html.erb:3:in `_app_views_dashboard__incomes_this_year_html_erb___42588926623323659_69927869341140'
  app/views/dashboard/index.html.erb:14:in `_app_views_dashboard_index_html_erb__4407725482129800723_69927870417740'

tommyblue avatar Sep 04 '13 15:09 tommyblue