Show recent featured asciicasts on homepage

This commit is contained in:
Marcin Kulik 2015-07-20 12:27:30 +00:00
parent 246263fcf8
commit ffe31c5258

View File

@ -28,7 +28,7 @@ class Asciicast < ActiveRecord::Base
scope :by_random, -> { order("RANDOM()") }
scope :non_private, -> { where(private: false) }
scope :homepage_latest, -> { non_private.by_date.limit(6).includes(:user) }
scope :homepage_featured, -> { non_private.featured.by_random.limit(6).includes(:user) }
scope :homepage_featured, -> { non_private.featured.where("created_at > ?", 1.year.ago).by_random.limit(6).includes(:user) }
before_create :generate_secret_token