Class: Omnitrack::Path::VisitEventsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/omnitrack/path/visit_events_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/omnitrack/path/visit_events_controller.rb', line 6

def index
  @page = [params.fetch(:page, 1).to_i, 1].max
  @per_page = Omnitrack.config.dashboard_per_page.to_i

  scoped = Omnitrack::VisitEvent.recent_first
  @total_count = scoped.count
  @total_pages = (@total_count.to_f / @per_page).ceil
  @events = scoped.includes(:delivery_statuses).offset((@page - 1) * @per_page).limit(@per_page)
end

#showObject



16
17
18
# File 'app/controllers/omnitrack/path/visit_events_controller.rb', line 16

def show
  @event = Omnitrack::VisitEvent.includes(:delivery_statuses).find(params[:id])
end