Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 5.2+ breaks Rails Admin integration #734

Closed
jkepps opened this issue Jul 26, 2019 · 4 comments
Closed

Upgrade to 5.2+ breaks Rails Admin integration #734

jkepps opened this issue Jul 26, 2019 · 4 comments

Comments

@jkepps
Copy link

jkepps commented Jul 26, 2019

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
@hjhart
Copy link
Contributor

hjhart commented Jul 31, 2019

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?

@hjhart
Copy link
Contributor

hjhart commented Jul 31, 2019

Submitted a pull request: #736

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

@ppostma
Copy link
Contributor

ppostma commented Nov 7, 2019

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.

@parndt
Copy link
Member

parndt commented Dec 13, 2019

#736 was merged

@parndt parndt closed this as completed Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants