title: Heroku (PG::Error: ERROR: column must appear in the GROUP BY clause or be used in an aggregate function
body: <p>I'm getting this error on Heroku but not locally (using PostgreSQL on both)..</p>
  
  <p>error is:</p>
  
  <pre><code>ActiveRecord::StatementInvalid (PG::Error: ERROR:  column "posts.content" must appear in the GROUP BY clause or be used in an aggregate function
  </code></pre>
  
  <p>I suspect it has something to do with this line in my posts model:</p>
  
  <pre><code>scope :with_tags, lambda { |tags| joins(:tags).group('posts.id').where(:tags =&gt; { :id =&gt; tags.map { |t| t.id } } ).having("COUNT(*) = ?", tags.length) }
  </code></pre>
  
  <p>why does it happen only on Heroku? how do I fix it ?</p>