Skip to content

Commit

Permalink
Updating to use two validation helpers so I can screenshot it for my …
Browse files Browse the repository at this point in the history
…talk.
  • Loading branch information
ChaelCodes committed May 21, 2024
1 parent 4f19d24 commit 84016c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Event < ApplicationRecord
has_many :event_attendees, dependent: :delete_all
has_many :attendees, through: :event_attendees, source: :profile

validates :start_at, :end_at, presence: true
validates_presence_of :start_at, :end_at
validates_comparison_of :end_at, greater_than: :start_at

scope :ongoing_or_upcoming, -> { where("end_at >= ?", Time.zone.now) }
Expand Down

0 comments on commit 84016c5

Please sign in to comment.