aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/public_body.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/public_body.rb')
-rw-r--r--app/models/public_body.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index b68722b81..8c749b1df 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -54,11 +54,12 @@ class PublicBody < ActiveRecord::Base
# like find_by_url_name but also search historic url_name if none found
def self.find_by_url_name_with_historic(name)
- @localer = I18n.locale.to_s
+ @locale = I18n.locale.to_s
PublicBody.with_locale(@locale) do
- found = PublicBody.find(:all,
- :conditions => ["public_body_translations.url_name='#{name}' AND public_body_translations.locale = '#{@localer}'"],
- :joins => :translations)
+ found = PublicBody.find(:all,
+ :conditions => ["public_body_translations.url_name='#{name}'"],
+ :joins => :translations,
+ :readonly => false)
return found.first if found.size == 1
# Shouldn't we just make url_name unique?
raise "Two bodies with the same URL name: #{name}" if found.size > 1