Class: Calendar
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Calendar
show all
- Includes:
- ScheduleFu::Finder
- Defined in:
- app/models/calendar.rb
Instance Method Summary
collapse
#conditions_for_date_finders
#parse, #parse_date, #parse_dates
Instance Method Details
#max_events_per_day_without_time_set(*args) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'app/models/calendar.rb', line 6
def max_events_per_day_without_time_set(*args)
conditions = conditions_for_date_finders(*args)
conditions[0] << ' AND (calendar_event_dates.start_time IS NULL OR calendar_event_dates.end_time IS NULL) AND calendars.id = ?'
conditions << self.id
row = CalendarEvent.count({:joins => [:calendar, :dates],
:conditions => conditions, :group => 'calendar_date_id',
:order => 'count_all DESC', :limit => 1})
row.empty? ? 0 : row.first[1]
end
|
#to_ical ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'app/models/calendar.rb', line 16
def to_ical
ical = Icalendar::Calendar.new
ical.prodid = 'ScheduleFu'
ical.name = 'Foo'
ical.to_ical
events.each do |event|
ical.event do
end
end
end
|