I had a strange problem when using the ActiveRecord :: Store module in my Ruby on Rails application. As far as I understand, this module uses the "serialize" method under the hood, so it simply converts your data into yaml format using the built-in Ruby gem file.
It works fine most of the time, but sometimes I get 500 errors with the following message:
LoadError (cannot load such file -- enc/trans/single_byte): ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/emitter.rb:27:in `write' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/emitter.rb:27:in `end_document' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/emitter.rb:27:in `visit_Psych_Nodes_Document' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/emitter.rb:20:in `block in visit_Psych_Nodes_Stream' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/emitter.rb:20:in `each' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/emitter.rb:20:in `visit_Psych_Nodes_Stream' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych/nodes/node.rb:46:in `yaml' ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/psych.rb:243:in `dump'
As you can see, I am using rbenv and ruby ββ1.9.3-p286. My system is Ubuntu 11.10. The required file exists ~/.rbenv/versions/1.9.3-p286/lib/ruby/1.9.1/i686-linux/enc/trans/single_byte.so . The same error I encountered with ruby ββ1.9.3-p194. And the strangest part of this problem is that this error occurs from time to time.
So maybe someone also ran into this problem and already found a solution? Or is it like a mistake in psychology, and I have to send it to her companion?
Thanks in advance for your help!
EDIT: The problem is not directly related to the psycho. This is a common problem with an unusual ruby ββsetting. See the accepted answer below for more details.
source share