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

Psych::DisallowedClass during some locale files convertion to js #798

Closed
dsawa opened this issue Apr 9, 2017 · 8 comments
Closed

Psych::DisallowedClass during some locale files convertion to js #798

dsawa opened this issue Apr 9, 2017 · 8 comments

Comments

@dsawa
Copy link

dsawa commented Apr 9, 2017

Hey,

I have recently updated React on Rails to the latest (6.9.3) and updated webpack to v2 (along with all configurations). However one thing changed that breaks my current project.

I get

Psych::DisallowedClass: Tried to load unspecified class: Symbol

every time I for example run rake commands (impossible to run migrations).

During investigation I managed to find a simple solution. Problem occurs in LocaleToJs.

If I change YAML.safe_load to just YAML.load it works. I could make a new PR with this small change, but I see that it was changed for some reason in PR that updated whole React on Rails to support webpack 2. What's the reason?

It can be pain in the ass when relying on different locale files from different gems that you not necesarrly can control. In my example, origins of the problem are from spree_i18n gem (FR translations).

Should I make PR with change to YAML.load ?

@justin808
Copy link
Member

@dsawa here's a discussion of the issue: ruby/psych#119

I need some more details on why this fails. I'm guessing that there's something odd about your translation files using symbols for values rather than strings.

It's 100% clear that YAML.safe_load was added so that if don't want arbitrary objects, then so be it.

Why would you have a symbol?

CC: @JasonYCHuang

@justin808
Copy link
Member

@dsawa is this still an issue?

@ilyamkin
Copy link

ilyamkin commented Apr 26, 2017

Same issue here.

UPD:
I made some workaround. These symbol locales were from other gem, so I moved my locales to locales/client and used the i18n_yml_dir property.
I think it's good to isolate translations. Can we add this property in react-webpack-rails-tutorial because I used all translations and configs from this project?

@dsawa
Copy link
Author

dsawa commented Apr 26, 2017

@justin808 Yes it is. Like @ilya4544 said, and me before, it's not me that I have symbol or something in translations. Those locales come from other gem.

I'll try ilya4544 workaround later.

@justin808
Copy link
Member

I'm open to a PR or reopening this discussion if needed.

@dimasjt
Copy link

dimasjt commented Apr 23, 2018

I got the same issue, it's because the translation have symbol value, I use rails-i18n https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/zh-CN.yml#L59

@markopavlovic
Copy link

same issue here, sometimes you use symbols for date definitions

@AntonAL
Copy link

AntonAL commented Dec 13, 2018

I had the same issue, found recent changes in my .yml file, that had used definitions like this:

formtastic:
    :yes: 'Да'

Changed :yes to yes like this,

formtastic:
    yes: 'Да'

and issues was disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants