Bugfix feed error

This commit is contained in:
Jesse C. Fisher 2023-11-22 12:32:10 +00:00
parent 2736c13aac
commit 74ca0a9082

View File

@ -128,8 +128,11 @@ class User < ActiveRecord::Base
end
def feed
micropost_ids = []
# Following posts
micropost_ids = self.following.map{|f| f.microposts.pluck(:id)}.flatten
if self.following.present?
micropost_ids << self.following.map{|f| begin; f.microposts.pluck(:id); rescue; end;}.flatten
end
# Self posts
micropost_ids << self.microposts.pluck(:id)
# Flatten for SQL query