From 421adfc65c97389a0b62ee3fd8d6ccb9e0f65300 Mon Sep 17 00:00:00 2001 From: Toks Date: Sat, 29 Mar 2014 16:28:55 -0400 Subject: [PATCH] Add unread dmail search option --- app/models/dmail.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/dmail.rb b/app/models/dmail.rb index f0f623321..69481ae1f 100644 --- a/app/models/dmail.rb +++ b/app/models/dmail.rb @@ -151,6 +151,12 @@ class Dmail < ActiveRecord::Base q = q.where("from_id = ?", params[:from_id].to_i) end + if params[:read] == "true" + q = q.where("is_read = true") + elsif params[:read] == "false" + q = q.unread + end + q end end