Remove current article id from potential queried articles (#247)

This commit is contained in:
Ben Halpern 2018-04-25 18:46:36 -04:00 committed by GitHub
parent af37587de5
commit 3903a3a5e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,6 +42,7 @@
includes(:user).
where("positive_reactions_count > ? OR comments_count > ?", (Rails.env.production? ? 20 : -1 ), (Rails.env.production? ? 8 : -1 )).
where(published: true).
where.not(id: @article.id).
where("featured_number > ?", 5.days.ago.to_i).
order("RANDOM()").
limit(8).