Class: EventsController

Inherits:
WhoopsController show all
Defined in:
app/controllers/events_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

TODO break this out into a more metal-y controller



22
23
24
25
# File 'app/controllers/events_controller.rb', line 22

def create
  Whoops::NewEvent.new(params[:event]).record!
  render :status => 200, :nothing => true
end

#indexObject



2
3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/events_controller.rb', line 2

def index
  @event_group = Whoops::EventGroup.where(new_whoops_filter.to_query_document).find(params[:whoops_event_group_id])
  
  events_base = @event_group.events
  unless params[:query].blank?
    conditions = Whoops::MongoidSearchParser.new(params[:query]).conditions
    events_base = events_base.where(conditions)
  end
  
  @events = events_base.desc(:event_time).page(params[:page]).per(20)
end

#showObject



14
15
16
17
18
19
# File 'app/controllers/events_controller.rb', line 14

def show
  @event = Whoops::Event.find(params[:id])
  respond_to do |format|
    format.js { render :partial => 'details', :object => @event, :as => :event}
  end
end