title: Having trouble with Rails query, ambiguous column name
body: <p>So I'm having a little difficulty using Rails to query some data. </p>
  
  <p>I have two models and I'm attempting to join one on to the other. My issue arises using a group by method. Both models have the same attribute name and this is causing an ambiguous column name error. My query is:</p>
  
  <p><code>Photo.joins(:votes).group(:photo_id, :image, :title, :bytes, :user_id, :public_id).order("count_all desc").limit(10).count</code> </p>
  
  <p>How can I choose which model that the group by attributes use?</p>