Sha256: 2a0306ba6352dbd7d18428da91cd808623160a2181478f881bca7f5aacffee1a

Contents?: true

Size: 520 Bytes

Versions: 5

Compression:

Stored size: 520 Bytes

Contents

module DateBook
  module ActsAsCalendar
    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
      extend ClassMethods
    end

    module InstanceMethods
      def event_occurrences
        events.as_occurrences.ascending
      end
    end

    module ClassMethods
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
date_book-0.0.6 lib/date_book/concerns/acts_as_calendar.rb
date_book-0.0.5 lib/date_book/concerns/acts_as_calendar.rb
date_book-0.0.3 lib/date_book/concerns/acts_as_calendar.rb
date_book-0.0.2 lib/date_book/concerns/acts_as_calendar.rb
date_book-0.0.1 lib/date_book/concerns/acts_as_calendar.rb