Skip to content

Commit

Permalink
add future/past scopes for episodes for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfiredrill committed Oct 18, 2023
1 parent eb3e749 commit 8923be8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/scheduled_show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class ScheduledShow < ActiveRecord::Base
accepts_nested_attributes_for :scheduled_show_performers
has_many :posts, as: :postable

scope :future, -> { where("start_at > ?", Time.now) }
scope :past, -> { where("start_at < ?", Time.now) }

validates_presence_of :guest, if: -> { is_guest? }
validates_presence_of :start_at, :end_at, :playlist_id, :title, :dj_id
validates :description, length: { maximum: 10_000 }
Expand Down

0 comments on commit 8923be8

Please sign in to comment.