Class: Calendar
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Calendar
- Defined in:
- app/models/calendar.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.categories ⇒ Object
29 30 31 |
# File 'app/models/calendar.rb', line 29 def self.categories categories = find( :all, :select => "DISTINCT category" ).map(&:category) end |
.slugs ⇒ Object
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_ical ⇒ Object
53 54 55 |
# File 'app/models/calendar.rb', line 53 def to_ical self.to_ri_cal.to_s end |
#to_ics ⇒ Object
37 38 39 |
# File 'app/models/calendar.rb', line 37 def to_ics ical.to_ics if ical end |
#to_ri_cal ⇒ Object
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_s ⇒ Object
41 42 43 |
# File 'app/models/calendar.rb', line 41 def to_s self.name end |