diff options
author | Faton Selishta <fatonselishta@gmail.com> | 2011-06-02 14:59:16 +0000 |
---|---|---|
committer | Faton Selishta <fatonselishta@gmail.com> | 2011-06-02 14:59:16 +0000 |
commit | 5d08750a5dc156ab6d19b3b6d1015b9371413bc3 (patch) | |
tree | c2c3c087282340374cf8f7c17b6c3be1aae10c42 /app/controllers/general_controller.rb | |
parent | 61c2cbe1f6a60beb8b2dd2fece6840646badb3de (diff) |
I18n fix
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r-- | app/controllers/general_controller.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index cf28208a0..bdbcfcdd4 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -20,9 +20,19 @@ class GeneralController < ApplicationController # New, improved front page! def frontpage - behavior_cache do # This is too slow - @popular_bodies = PublicBody.find(:all, :select => "*, (select count(*) from info_requests where info_requests.public_body_id = public_bodies.id) as c", :order => "c desc", :limit => 32) + @locale = self.locale_from_params() + locale_condition = 'public_body_translations.locale = ?' + conditions = [locale_condition, @locale] + PublicBody.with_locale(@locale) do + @popular_bodies = PublicBody.find(:all, + :select => "public_bodies.*, (select count(*) from info_requests where info_requests.public_body_id = public_bodies.id) as c", + :order => "c desc", + :limit => 32, + :conditions => conditions, + :joins => :translations + ) + end # Get some successful requests # begin query = 'variety:response (status:successful OR status:partially_successful)' @@ -34,7 +44,6 @@ class GeneralController < ApplicationController rescue @successful_request_events = [] end - end end # Display WhatDoTheyKnow category from mySociety blog |