From be71f9ff82036f3aaddc161405e26ba8f9379405 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 18 Jul 2018 11:25:16 +0800 Subject: [PATCH] REFACTOR: Don't load entire AR object just to get a column. --- app/models/email_log.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/email_log.rb b/app/models/email_log.rb index 10240f8bc70..b2d88d3c1cc 100644 --- a/app/models/email_log.rb +++ b/app/models/email_log.rb @@ -65,8 +65,9 @@ class EmailLog < ActiveRecord::Base def self.last_sent_email_address self.where(email_type: "signup") .order(created_at: :desc) + .limit(1) + .pluck(:to_address) .first - .try(:to_address) end def bounce_key