aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-09-26 13:21:07 +0100
committerLouise Crow <louise.crow@gmail.com>2014-09-26 13:21:07 +0100
commitadf92e9b6e5d3f1ab6a08cf72c15362a4fd6af2b (patch)
tree89f01bc09bdadf52c17d79152e5eb2d0384af603 /lib
parentd0a21efb7170057a78abc88e7bee929714edc302 (diff)
Find by translated name correctly.
.where doesn't seem to use the translations with this version of Globalize, even in a locale block. As this is run-once code to migrate, I think we're fine with the old syntax.
Diffstat (limited to 'lib')
-rw-r--r--lib/category_and_heading_migrator.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/category_and_heading_migrator.rb b/lib/category_and_heading_migrator.rb
index 93b8fc3b2..7a7057887 100644
--- a/lib/category_and_heading_migrator.rb
+++ b/lib/category_and_heading_migrator.rb
@@ -59,8 +59,10 @@ module CategoryAndHeadingMigrator
end
def self.add_heading(name, locale, first_locale)
- heading = PublicBodyHeading.with_translations.where(:name => name).first
-
+ heading = nil
+ I18n.with_locale(locale) do
+ heading = PublicBodyHeading.find_by_name(name)
+ end
# For multi-locale installs, we assume that all public_body_[locale].rb files
# use the same headings in the same order, so we add translations to the heading
# that was in the same position in the list loaded from other public_body_[locale].rb