From d58a1507565629b4dc00faa72195cd703dd978af Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 6 Mar 2014 18:56:44 -0800 Subject: [PATCH] potential fix for #1428 --- app/models/dmail.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/dmail.rb b/app/models/dmail.rb index 6cdac3502..d3aa553d4 100644 --- a/app/models/dmail.rb +++ b/app/models/dmail.rb @@ -181,7 +181,7 @@ class Dmail < ActiveRecord::Base def mark_as_read! update_column(:is_read, true) - unless Dmail.exists?(["to_id = ? AND is_read = false", to_id]) + unless Dmail.where(:is_read => false, :owner_id => owner_id).exists? to.update_column(:has_mail, false) end end