Change includes aspects to joins aspects

This commit is contained in:
danielgrippi 2011-03-15 14:59:59 -07:00
parent 4e4e4d763a
commit 39b8fed431

View file

@ -79,7 +79,9 @@ module Diaspora
def posts_from(person)
asp = Aspect.arel_table
p = Post.arel_table
person.posts.includes(:aspects, :comments).where( p[:public].eq(true).or(asp[:user_id].eq(self.id))).select('DISTINCT `posts`.*').order("posts.created_at DESC")
person.posts.joins(:aspects).includes(:comments).where(
p[:public].eq(true).or(asp[:user_id].eq(self.id))
).select('DISTINCT `posts`.*').order("posts.created_at DESC")
end
end
end