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

Updating fields_with_locales has weird unintuitive behaviour #202

Open
HQ063 opened this issue Jul 12, 2019 · 0 comments
Open

Updating fields_with_locales has weird unintuitive behaviour #202

HQ063 opened this issue Jul 12, 2019 · 0 comments

Comments

@HQ063
Copy link
Contributor

HQ063 commented Jul 12, 2019

Assigning a hash to field_with_locales doesn't override the current hash.
And trying to manipulate the existing field_with_locales hash didn't do anything.

This looks totally weird and unintuitive.

[178] pry(main)> entry.title_with_locales = {'en-CA' => 'Title'}
=> {"en-CA"=>"Title"}
[179] pry(main)> entry.title_with_locales 
=> {"en-CA"=>"Title"}
[180] pry(main)> entry.title_with_locales['fr-CA'] = 'TitleFR'
=> "TitleFR"
[181] pry(main)> entry.title_with_locales 
=> {"en-CA"=>"Title"}
[182] pry(main)> entry.title_with_locales = {'fr-CA' => 'TitleFR'}
=> {"fr-CA"=>"TitleFR"}
[183] pry(main)> entry.title_with_locales 
=> {"en-CA"=>"Title", "fr-CA"=>"TitleFR"}
[184] pry(main)> entry.title_with_locales.delete 'en-CA'
=> "Title"
[185] pry(main)> entry.title_with_locales 
=> {"en-CA"=>"Title", "fr-CA"=>"TitleFR"}

And also it doesn't allow us to delete an existing key.

This issue combined with #204, creates a messy situation that forces us to use a lot of weird workarounds to be able to edit the content in the spaces that are not using the client default locale.

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

1 participant