Module: DateBook::ActsAsCalendar

Defined in:
lib/date_book/concerns/acts_as_calendar.rb

Overview

Mixin to allow acts_as_calendar behavior in Calendar model

Defined Under Namespace

Modules: InstanceMethods

Instance Method Summary collapse

Instance Method Details

#acts_as_calendar(_options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/date_book/concerns/acts_as_calendar.rb', line 6

def acts_as_calendar(_options = {})
  acts_as_ownable

  validates_presence_of :name, :slug

  # FriendlyId Gem
  extend FriendlyId
  friendly_id :name, use: :slugged

  # Relationships
  has_many :events, dependent: :destroy

  include InstanceMethods
end