Bugfix feed error
This commit is contained in:
parent
cc102a5e2b
commit
de5961e602
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user