diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2016-08-01 21:41:46 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2016-08-01 21:52:18 +0200 |
commit | 31448f2b7fa6f3920485229e5710d9fcf87f190d (patch) | |
tree | 3bc464d5c6c38e7480e9770273f4ce21c03561d3 /ci | |
parent | c205e3fca333e7c24dd1e36d439f83cdaf074e44 (diff) | |
download | rails-31448f2b7fa6f3920485229e5710d9fcf87f190d.tar.gz rails-31448f2b7fa6f3920485229e5710d9fcf87f190d.tar.bz2 rails-31448f2b7fa6f3920485229e5710d9fcf87f190d.zip |
Make Parameters support legacy YAML encodings.
By changing ActionController::Parameter's superclass, Rails 5 also changed
the YAML serialization format.
Since YAML doesn't know how to handle parameters it would fallback to its
routine for the superclass, which in Rails 4.2 was Hash while just Object
in Rails 5. As evident in the tags YAML would spit out:
4.2: !ruby/hash-with-ivars:ActionController::Parameters
5.0: !ruby/object:ActionController::Parameters
Thus when loading parameters YAML from 4.2 in Rails 5, it would parse a
hash dump as it would an Object class.
To fix this we have to provide our own `init_with` to be aware of the past
format as well as the new one. Then we add a `load_tags` mapping, such that
when the YAML parser sees `!ruby/hash-with-ivars:ActionController::Parameters`,
it knows to call our `init_with` function and not try to instantiate it as
a normal hash subclass.
Diffstat (limited to 'ci')
0 files changed, 0 insertions, 0 deletions