globalize/globalize

Upgrade to 5.2+ breaks Rails Admin integration

jkepps opened this issue · 4 comments

It appears there was a change in 5.2.0 that broke integration with rails_admin. I am able to load the translations in the interface just as before, but saving the record does not persist any changes to the translations to the DB, nor will it persist any newly created translations. Happy to provide whatever additional information is needed, but repro steps are fairly simple.

Globalize 5.3.0
RailsAdmin 1.4.2

Below is a sample configuration for a model that has a name, and a translated field of display_name

config.model 'Page' do
    object_label_method { :name }
    field(:name)
end

config.model 'Page::Translations' do
    visible false
    configure :locale do
      help ''
    end
    include_fields :locale, :display_name
end

Did a little bit of digging and it appears that this is directly related to this change: 6356f95#diff-a4e451ff8babf2969ff95b0205af6dd1R78

When we set autosave to true, things start working. But when autosave is false it doesn't work.

Is it possible that we could make autosave configurable? Would a PR be accepted?

Submitted a pull request: #736

I can backfill specs if this PR seems reasonable and will be accpted.

We noticed this change in behavior too when updating to 5.3.0 (we are not using rails_admin).

You can work-around this problem without patching globalize by adding the following to your model:

accepts_nested_attributes_for :translations

This automatically sets autosave to true on the translations association.

#736 was merged