Class: Trackguard::Admin::VisitsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/trackguard/admin/visits_controller.rb

Constant Summary collapse

PER_PAGE =
20

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/trackguard/admin/visits_controller.rb', line 6

def index
  @page   = [ (params[:page] || 1).to_i, 1 ].max
  @total  = PageView.count
  @pages  = (@total.to_f / PER_PAGE).ceil
  @visits = PageView.order(created_at: :desc)
                    .limit(PER_PAGE)
                    .offset((@page - 1) * PER_PAGE)
                    .includes(visitor: :whitelisted_ip)
end