title: Use group in rails when you use nested of nested attributes
body: <p>I have this models</p>
  
  <p>point -> belongs_to :days</p>
  
  <p>days  -> belongs_to :routes</p>
  
  <p>and I would like to group by point <code>:address</code> all the point of one kind of route, I can get all:</p>
  
  <pre><code>Point.includes(:day =&gt; :route).where(days:{routes:{place: "Dublin"}})
  </code></pre>
  
  <p>but if I try to use <code>group(:address)</code>, I find this error:</p>
  
  <pre><code>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, 
  "...
  </code></pre>
  
  <p>Could you help me? thanks</p>