Class: ActiveStorageDashboard::ApplicationController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/active_storage_dashboard/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#paginate(scope, per_page = 20) ⇒ Object



10
11
12
13
# File 'app/controllers/active_storage_dashboard/application_controller.rb', line 10

def paginate(scope, per_page = 20)
  @page = [params[:page].to_i, 1].max
  scope.limit(per_page).offset((@page - 1) * per_page)
end