diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/event.rb | 2 | ||||
-rw-r--r-- | app/models/organisation.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/models/event.rb b/app/models/event.rb index 9dea7b8..aaa4e6e 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -2,6 +2,8 @@ class Event < ApplicationRecord validates :name, presence: true, length: { maximum: 50 } validates :date, presence: true + belongs_to :organisation, optional: true + def month_year_check(year, month) if self.date.year == year && self.date.month == month true diff --git a/app/models/organisation.rb b/app/models/organisation.rb new file mode 100644 index 0000000..aa67564 --- /dev/null +++ b/app/models/organisation.rb @@ -0,0 +1,3 @@ +class Organisation < ApplicationRecord + has_many :events +end |