Rails: cannot load such file — safe_yaml/transform/to_symbol (LoadError)

穿精又带淫゛_ 提交于 2019-12-24 09:36:19

问题


My rails app is not running and i am getting error:

  cannot load such file -- safe_yaml/transform/to_symbol (LoadError)

I dont know why this error is coming. When i remove gem 'safe_yaml', it gives error:

 Could not find safe_yaml-0.9.4 in any of the sources (Bundler::GemNotFound)

When i install gem safe_yaml-0.9.4, it gives:

 cannot load such file -- safe_yaml/transform/to_symbol (LoadError)

Can anybody tell how to solve this?

Thanks


回答1:


There was problem with safe_yaml version.

I have rails-admin 0.4.9. For this, safe_yaml 0.6.3 is required where rails_admin 0.4.9 installs safe_yaml 0.9.4.

So i included safe_yaml 0.6.3 in my gemfile separately and removed safe_yaml 0.6.4.

And everything worked!!

Thank everyone for help.




回答2:


There is a bug in the 0.9.4 release of safe_yaml. The file lib/safe_yaml/transform/to_symbol.rb has permissions of 640 instead of 644. If your gem is installed as root, this will cause the file to be unreadable by anything not root. Besides falling back to 0.9.3 (I think that is what the prior poster really meant instead of 0.6.3), you could chmod the file to 644 yourself and you can get past this bug.



来源:https://stackoverflow.com/questions/17772142/rails-cannot-load-such-file-safe-yaml-transform-to-symbol-loaderror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!