我有这个模特
点 - > belongs_to:days
天 - > belongs_to:routes
我希望按点:address
分组一种路线,我可以得到所有这些:
Point.includes(:day => :route).where(days:{routes:{place: "Dublin"}})
但如果我尝试使用group(:address)
,我会发现此错误:
ActiveRecord::StatementInvalid: PG::GroupingError: ERROR: column
"points.id" must appear in the GROUP BY clause or be used in an
aggregate function
LINE 1: SELECT "points"."id" AS t0_r0, "points"."title" AS t0_r1,
"...
你可以帮帮我吗?感谢