Bugfix feed error
This commit is contained in:
parent
2736c13aac
commit
74ca0a9082
@ -128,8 +128,11 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def feed
|
def feed
|
||||||
|
micropost_ids = []
|
||||||
# Following posts
|
# 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
|
# Self posts
|
||||||
micropost_ids << self.microposts.pluck(:id)
|
micropost_ids << self.microposts.pluck(:id)
|
||||||
# Flatten for SQL query
|
# Flatten for SQL query
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user