blob: 60b8521fbb2723816968b098e8392a086986ba13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
class Event < ActiveRecord::Base
# Associations
has_many :occurrences
belongs_to :node
# Callbacks
after_save :generate_occurences
# Instance Methods
def occurrences_in_range start_time, end_time
self.occurrences.find(
:all, :conditions => [
"start_time > ? AND end_time < ?",
start_time, end_time
]
)
end
private
def generate_occurences
Occurrence.generate self
end
end
|