aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-08-28 10:45:20 +0100
committerLouise Crow <louise.crow@gmail.com>2012-08-28 10:45:20 +0100
commitee723d9e6645bc7987cb2b7cc9cd320950536201 (patch)
treef5beec1ffc37c9530485c0cd5be15c56210ae2da /app/controllers/application_controller.rb
parente98bfd6e9ed7e6bb151d0eb5c216cad0fed6a40c (diff)
parent5c1a88c88ba69cec3924ec8a1d69d8784acaef3c (diff)
Merge branch 'release/0.6.4'0.6.4
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 11f21025c..ce18e6ef5 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -134,6 +134,10 @@ class ApplicationController < ActionController::Base
# Make sure expiry time for session is set (before_filters are
# otherwise missed by this override)
session_remember_me
+
+ # Make sure the locale is set correctly too
+ set_gettext_locale
+
case exception
when ActiveRecord::RecordNotFound, ActionController::UnknownAction, ActionController::RoutingError
@status = 404
@@ -157,6 +161,9 @@ class ApplicationController < ActionController::Base
# otherwise missed by this override)
session_remember_me
+ # Make sure the locale is set correctly too
+ set_gettext_locale
+
# Display default, detailed error for developers
original_rescue_action_locally(exception)
end
@@ -206,13 +213,16 @@ class ApplicationController < ActionController::Base
foi_cache_path = File.expand_path(File.join(File.dirname(__FILE__), '../../cache'))
return File.join(foi_cache_path, path)
end
+
def foi_fragment_cache_exists?(key_path)
return File.exists?(key_path)
end
+
def foi_fragment_cache_read(key_path)
logger.info "Reading from fragment cache #{key_path}"
return File.read(key_path)
end
+
def foi_fragment_cache_write(key_path, content)
FileUtils.mkdir_p(File.dirname(key_path))
logger.info "Writing to fragment cache #{key_path}"
@@ -382,8 +392,11 @@ class ApplicationController < ActionController::Base
# might fail later if the database has subsequently been reopened.
return result
end
+
def get_search_page_from_params
- return (params[:page] || "1").to_i
+ page = (params[:page] || "1").to_i
+ page = 1 if page < 1
+ return page
end
def perform_search_typeahead(query, model)