Class: QuoVadis::LogsController

Inherits:
QuoVadisController show all
Defined in:
app/controllers/quo_vadis/logs_controller.rb

Constant Summary collapse

PER_PAGE =
25

Instance Method Summary collapse

Instance Method Details

#indexObject



9
10
11
12
13
14
15
16
17
# File 'app/controllers/quo_vadis/logs_controller.rb', line 9

def index
  logs = authenticated_model..logs

  page = params[:page] ? params[:page].to_i : 1
  @logs = logs.new_to_old.page(page, PER_PAGE)

  @prev_page = page - 1 if page > 1
  @next_page = page + 1 if logs.count > page * PER_PAGE
end