ActiveRecords not serializing in yaml correctly

When I serialize active records, I find that the yaml format differs depending on which one I'm running in. On one box I get:

object: !ruby/object:User 

instead

object: !ruby/ActiveRecord:User 

The first version is a problem because active support needs to do some magic in order to properly populate the active record when yaml is deserialized. What causes this difference and how can I ensure the use of the second format?


I am using ruby ​​1.9.2 and I made the yaml mechanism use syck using

require "yaml"
YAML::ENGINE.yamler = "syck"

in the boot.rb application (rails).

Update

After digging in a bit, I found that the ActiveRecord type is not registered in yaml. On the server where the following call is running:

YAML.resolver.tags.keys

includes:

"tag:ruby.yaml.org,2002:ActiveRecord"

, . , , .

+3
2

, .

, . config/setup_load_paths.rb, Gemfile .

require "yaml"
YAML::ENGINE.yamler = "syck"

Gemfile, , yaml. Gemfile, , pysch syck. delayed_job syck, - , , syck- .

0

Rails. :

 config.cache_classes = true

config/environment/development.rb?

0

All Articles