diff options
| author | mo khan <mo@mokhan.ca> | 2014-02-20 18:42:01 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-02-20 18:42:01 -0700 |
| commit | ab6a0801874f7bd6590f6e57ee76cd2b74c30618 (patch) | |
| tree | 0a44518f956384389a075ecc3b363bf6aaf26a7f /app/controllers | |
| parent | e602075ef3bc53075129b1427ea880eaea2def5a (diff) | |
return a specific page of results.
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/v1/licenses_controller.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/v1/licenses_controller.rb b/app/controllers/v1/licenses_controller.rb index 86eb85e..e919663 100644 --- a/app/controllers/v1/licenses_controller.rb +++ b/app/controllers/v1/licenses_controller.rb @@ -1,8 +1,10 @@ class V1::LicensesController < ApplicationController + PER_PAGE = 10 + DEFAULT_PAGE = 1 + def index - per_page = 10 - page = 1 - @licenses = License.most_recent(page, per_page) + page = params[:page].to_i || DEFAULT_PAGE + @licenses = License.most_recent(page, PER_PAGE) render nothing: true end end |
