Class: EventsController

Inherits:
ApplicationController
  • Object
show all
Includes:
SocialStream::Controllers::Objects
Defined in:
app/controllers/events_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/events_controller.rb', line 8

def index
  index! do |format|
    format.json {
      start_time = Time.at(params[:start].to_i)
      end_time   = Time.at(params[:end].to_i)
      @activities =
        collection.
         joins(:activity_objects => :event).
          merge(Event.between(start_time, end_time))

      render :json =>
        @activities.
          map(&:direct_object).
          map{ |e| e.to_json(:start => start_time, :end => end_time) }.flatten.to_json
    }
  end
end

#showObject



26
27
28
29
30
# File 'app/controllers/events_controller.rb', line 26

def show
  show! do |format|
    format.html { redirect_to polymorphic_path([ @event.post_activity.receiver_subject, Event.new ], :at => @event.start_at.to_i) }
  end
end