Class: Event
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Event
- Includes:
- SocialStream::Models::Object
- Defined in:
- app/models/event.rb
Instance Method Summary collapse
Instance Method Details
#to_json(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/event.rb', line 12 def to_json( = {}) if recurrence st = [:start].try(:to_date) en = ([:end] || end_at.end_of_month + 7.days).to_date recurrence.events(:starts => st, :until => en).map do |d| start_diff = d - start_at.to_date end_diff = d - end_at.to_date build_json start_at.advance(:days => start_diff), end_at.advance(:days => end_diff) end else build_json end end |