Created
February 1, 2012 21:11
-
-
Save lonelydimple/1719488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :unread_for_user, lambda { |user| | |
if user | |
{ | |
:joins => "left outer join read_receipts rr on messages.id = rr.readable_id and rr.readable_type = 'message' and rr.user_id = #{user.id}", | |
:conditions => "rr.id is NULL" | |
} | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment