diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-12-17 15:32:39 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-12-17 15:34:31 +0000 |
commit | de20a797f247df93177e2754420d8478866a64b3 (patch) | |
tree | d3c20392a1b3509635e834279044c11257e45d84 /app/controllers/request_controller.rb | |
parent | b446bbee9d936f3f5424f4c79b34577416a68f7f (diff) |
Only serve up 'similar' pages up to the offset we use for list.
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index d8c34c2dd..5d950ceb2 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -139,6 +139,11 @@ class RequestController < ApplicationController short_cache @per_page = 25 @page = (params[:page] || "1").to_i + + # Later pages are very expensive to load + if @page > MAX_RESULTS / PER_PAGE + raise ActiveRecord::RecordNotFound.new("Sorry. No pages after #{MAX_RESULTS / PER_PAGE}.") + end @info_request = InfoRequest.find_by_url_title!(params[:url_title]) raise ActiveRecord::RecordNotFound.new("Request not found") if @info_request.nil? |