PERF: Scanning the id for this is signficantly slower in production

This commit is contained in:
Robin Ward 2018-06-28 11:04:40 -04:00
parent fd7bb8e656
commit 5d1d7e0e7d

View File

@ -449,7 +449,7 @@ class User < ActiveRecord::Base
def publish_notifications_state
# publish last notification json with the message so we can apply an update
notification = notifications.visible.order('notifications.id desc').first
notification = notifications.visible.order('notifications.created_at desc').first
json = NotificationSerializer.new(notification).as_json if notification
sql = (<<~SQL).freeze