Class: ErrorLens::OccurrencesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/error_lens/occurrences_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/error_lens/occurrences_controller.rb', line 3

def show
  @group      = ErrorLens::ErrorGroup.find(params[:error_id])
  @occurrence = @group.occurrences.find(params[:id])

  @newer = @group.occurrences
                 .where("occurred_at > ?", @occurrence.occurred_at)
                 .order(occurred_at: :asc)
                 .first

  @older = @group.occurrences
                 .where("occurred_at < ?", @occurrence.occurred_at)
                 .order(occurred_at: :desc)
                 .first
end