diff options
author | Matthew Lemon <y@yulqen.org> | 2023-12-18 17:01:29 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-12-18 17:01:29 +0000 |
commit | 7483d6b8652854dbab53337b57467f69c7a2cad4 (patch) | |
tree | b0dac0a2fcc37567298d82e9325b346a8569a416 /app/models | |
parent | c504e1e907ea68e3b777db5d286974010d2361c0 (diff) |
Adds some specs for testing events
Adds a method to Event to check its membership of a month in a
particular year.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/event.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index 1f722d3..9dea7b8 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,4 +1,12 @@ class Event < ApplicationRecord validates :name, presence: true, length: { maximum: 50 } validates :date, presence: true + + def month_year_check(year, month) + if self.date.year == year && self.date.month == month + true + else + false + end + end end |