diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-07-06 13:22:45 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-07-06 13:22:45 +0100 |
commit | b172995023ea90bac0bb534f8f185fa435f8aefd (patch) | |
tree | fee15d4f15f3df60f82ae6d4f8a5931bd35c2eeb /app/controllers/general_controller.rb | |
parent | 732b3e5c430a83f72adb44dc621d48edb86f081f (diff) |
Changes required to get selishta (Kosovo) fork merges to pass tests. Includes new "REPLY_LATE_AFTER_DAYS" config option.
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r-- | app/controllers/general_controller.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 21f3edbb1..17f39740f 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -26,10 +26,10 @@ class GeneralController < ApplicationController # get some example searches and public bodies to display # either from config, or based on a (slow!) query if not set body_short_names = MySociety::Config.get('FRONTPAGE_PUBLICBODY_EXAMPLES', '').split(/\s*;\s*/).map{|s| "'%s'" % s.gsub(/'/, "''") }.join(", ") - @locale = self.locale_from_params() - locale_condition = 'public_body_translations.locale = ?' + @locale = self.locale_from_params() + locale_condition = 'public_body_translations.locale = ?' conditions = [locale_condition, @locale] - PublicBody.with_locale(@locale) do + PublicBody.with_locale(@locale) do if body_short_names.empty? # This is too slow @popular_bodies = PublicBody.find(:all, @@ -40,8 +40,9 @@ class GeneralController < ApplicationController :joins => :translations ) else + conditions[0] += " and public_bodies.url_name in (" + body_short_names + ")" @popular_bodies = PublicBody.find(:all, - :conditions => conditions + ["url_name in (" + body_short_names + ")"], + :conditions => conditions, :joins => :translations) end end |