vendredi 1 décembre 2017

Globilize updates all translations, except the 'title'

I'm using Globalize 3.1 and globalize-accessors on an old rails 3.2 project, in order to store some translated fields, in 3 languages. I have two models, a Company with many basic details [title, address, lat, lng, image etc], where I translate the 'title' and a Description with two fields [summary and description], where I translate both the 'summary' and 'description'.

I'm using simple_forms to add all translated fields in my admin, in [:en, :de, :it] locales.

Everything stores and updates without any problem, but the 'title_en' from the Company remains the initial, so I cannot change it if I want.

in Company model

translates :title
globalize_accessors locales: [:en, :de, :it], attributes: [:title]

in Controller

permitted = [:title_en, :title_de, :title_it, :address, :lat, :lng, 
{ description_attributes: [ :summary_en, :description_en, :summary_de, :description_de, :summary_it, :description_it ] }, ....

in my View

   <strong>English Translation:</strong>
    <%= f.input :title_it %>
    <%= f.simple_fields_for :description do |p| %>
     <%= p.input :summary_en %>
     <%= p.input :description_en, :as => :text, :input_html => { :rows => 20 } %>
    <% end %>
   <hr>
   <strong>Italian Translation:</strong>
    <%= f.input :title_it %>
    <%= f.simple_fields_for :description do |p| %>
     <%= p.input :summary_it %>
     <%= p.input :description_it, :as => :text %>
    <% end %>
   <hr>

I have double check every possible misspell or error, but the problem remains, no matter if I'm just adding the empty translation to a Company, or I have already filled all translated fields. The 'title_en' remains always the same. All other fields (title_it, title_de, summary_en, description_en, description_it etc) can be updated without any issue.

Do you have any idea? Thank you!

Aucun commentaire:

Enregistrer un commentaire