removes whitespaces and uses scope

This commit is contained in:
Gerhard Schlager
2017-11-13 15:20:36 +01:00
parent 7370adeae3
commit d3baae5365
3 changed files with 15 additions and 13 deletions

View File

@ -4,6 +4,8 @@ class IncomingEmail < ActiveRecord::Base
belongs_to :post
scope :errored, -> { where("NOT is_bounce AND error IS NOT NULL") }
scope :addressed_to, -> (email) { where('incoming_emails.to_addresses ILIKE :email OR incoming_emails.cc_addresses ILIKE :email', email: "%#{email}%") }
end
# == Schema Information