Skip to content

Instantly share code, notes, and snippets.

@pjhyett
Created September 25, 2008 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjhyett/12716 to your computer and use it in GitHub Desktop.
Save pjhyett/12716 to your computer and use it in GitHub Desktop.
has_many :unread_messages,
:class_name => 'Message',
:foreign_key => :to_id,
:conditions => { :to_deleted => false, :unread => true },
:group => :source_id
PGError: ERROR: column "messages.id" must appear in the GROUP BY clause or be used in an aggregate function
: SELECT * FROM "messages" WHERE ("messages".to_id = 48 AND ("messages"."to_deleted" = 'f' AND "messages"."unread" = 't')) GROUP BY source_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment