Class: Calendar

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/calendar.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.categoriesObject



29
30
31
# File 'app/models/calendar.rb', line 29

def self.categories
  categories = find( :all, :select => "DISTINCT category" ).map(&:category)
end

.slugsObject



33
34
35
# File 'app/models/calendar.rb', line 33

def self.slugs
  slugs = find( :all, :select => "DISTINCT slug" ).map(&:slug)
end

Instance Method Details

#to_icalObject



53
54
55
# File 'app/models/calendar.rb', line 53

def to_ical
  self.to_ri_cal.to_s
end

#to_icsObject



37
38
39
# File 'app/models/calendar.rb', line 37

def to_ics
  ical.to_ics if ical
end

#to_ri_calObject



45
46
47
48
49
50
51
# File 'app/models/calendar.rb', line 45

def to_ri_cal
  RiCal.Calendar do |cal|
    events.primary.each do |event|
      cal.add_subcomponent(event.to_ri_cal)
    end
  end
end

#to_sObject



41
42
43
# File 'app/models/calendar.rb', line 41

def to_s
  self.name
end