diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-09-24 09:23:44 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-24 09:23:44 +0100 |
commit | 7d9b66d1ff31afa8d73ea1a81f4e612e41f89cb0 (patch) | |
tree | 5206d9fbaf8d6af58bdaa35cefdfeb34a88c84ff /app/controllers/admin_public_body_controller.rb | |
parent | 40a28fa2fe21d752a15c11938791d620dd31d17f (diff) | |
parent | 8e7432be764254e6a50e6a06e77bb93bb5bba9fe (diff) |
Merge branch 'release/0.14' into wdtk
Conflicts:
app/views/request/show.html.erb
Diffstat (limited to 'app/controllers/admin_public_body_controller.rb')
-rw-r--r-- | app/controllers/admin_public_body_controller.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index ec2a08dbc..e0da234b0 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -14,6 +14,7 @@ class AdminPublicBodyController < AdminController def _lookup_query_internal @locale = self.locale_from_params() + underscore_locale = @locale.gsub '-', '_' I18n.with_locale(@locale) do @query = params[:query] if @query == "" @@ -23,10 +24,10 @@ class AdminPublicBodyController < AdminController if @page == "" @page = nil end - @public_bodies = PublicBody.joins(:translations).where(@query.nil? ? "public_body_translations.locale = '#{@locale}'" : + @public_bodies = PublicBody.joins(:translations).where(@query.nil? ? "public_body_translations.locale = '#{underscore_locale}'" : ["(lower(public_body_translations.name) like lower('%'||?||'%') or lower(public_body_translations.short_name) like lower('%'||?||'%') or - lower(public_body_translations.request_email) like lower('%'||?||'%' )) AND (public_body_translations.locale = '#{@locale}')", @query, @query, @query]).paginate :order => "public_body_translations.name", :page => @page, :per_page => 100 + lower(public_body_translations.request_email) like lower('%'||?||'%' )) AND (public_body_translations.locale = '#{underscore_locale}')", @query, @query, @query]).paginate :order => "public_body_translations.name", :page => @page, :per_page => 100 end @public_bodies_by_tag = PublicBody.find_by_tag(@query) end |