app/models/lalala/page.rb in lalala-4.0.0.dev.134 vs app/models/lalala/page.rb in lalala-4.0.0.dev.135

- old
+ new

@@ -247,10 +247,11 @@ end # update translated attributes begin _locale = I18n.locale + I18n.available_locales.each do |locale| I18n.locale = locale translated_attrs.each do |attr| next if prev_page.send(attr).present? @@ -275,19 +276,26 @@ self.children = children end def set_path_component - r = self.route - case r - when NilClass - self.path_component = self.class.default_route.call(self) - when Proc - self.path_component = r.call(self) - when String - self.path_component = r - else - raise "Unexpected path_component value: #{r.inspect}" + _locale = I18n.locale + I18n.available_locales.each do |locale| + + r = self.route + case r + when NilClass + self.path_component = self.class.default_route.call(self) + when Proc + self.path_component = r.call(self) + when String + self.path_component = r + else + raise "Unexpected path_component value: #{r.inspect}" + end + end + ensure + I18n.locale = _locale end end