Fix exception when using locale as a parameter in the url

When visiting, for example, /admin/site_customization/information_texts?locale=fr
we were getting an `UncaughtThrowError: uncaught throw :exception`
With the following payload
```
File "/aytomad/app/participa/participacion/releases/20180726231929/app/views/admin/site_customization/information_texts/_form_field.html.erb" line 5

File "/aytomad/app/participa/participacion/releases/20180726231929/app/helpers/globalize_helper.rb" line 35 in block in globalize
```

Substituting this line seems to solve it

Note that we had to remove the portuguese local too, as it was giving a different
exception due to this change. This problem, has been solved in the original
globalization PR
This commit is contained in:
rgarcia
2018-07-27 01:50:51 +02:00
committed by Angel Perez
parent a943c24aa7
commit 12f6f06ade
2 changed files with 2 additions and 2 deletions

View File

@@ -6,6 +6,6 @@ class I18nContent < ActiveRecord::Base
validates :key, uniqueness: true
translates :value, touch: true
globalize_accessors locales: [:en, :es, :fr, :nl, :val, :pt_br]
globalize_accessors locales: [:en, :es, :fr, :nl, :val]
end

View File

@@ -2,7 +2,7 @@
<%= hidden_field_tag "contents[content_#{content.key}][id]", content.key %>
<%= text_area_tag "contents[content_#{content.key}]values[value_#{locale}]",
I18nContent.where(key: content.key).first.try(:value) ||
I18n.backend.translate(locale, content.key),
t(content.key, locale: locale),
{ rows: 5,
class: "js-globalize-attribute",
style: display_translation?(locale),