aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/yaml_serialization_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add YAML compatibility for objects from Rails 4.2Sean Griffin2015-03-101-26/+18
| | | | | | | | | | | As of Ruby 2.2, Psych can handle any object which is marshallable. This was not true on previous versions of Ruby, so our delegator types had to provide their own implementation of `init_with` and `encode_with`. Unfortunately, this doesn't match up with what Psych will do today. Since by the time we hit this layer, the objects will have already been created, I think it makes the most sense to just grab the current type from the class.
* Attempt to provide backwards compatible YAML deserializationSean Griffin2015-03-101-0/+43
| | | | | | | | | | | | | | | | | | I should have done this in the first place. We are now serializing an explicit version so we can make more careful changes in the future. This will load Active Record objects which were serialized in Rails 4.1. There will be bugs, as YAML serialization was at least partially broken back then. There will also be edge cases that we might not be able to handle, especially if the type of a column has changed. In addition, we're passing this as `from_database`, since that is required for serialized columns at minimum. All other types were serializing the cast value. At a glance, there should be no types for which this is a problem. Finally, dirty checking information will be lost on records serialized in 4.1, so no columns will be marked as changed.
* Implement required #encode_withGustavo Beathyate2014-07-151-0/+1
| | | | | | | While running the spec `ARCONN=mysql2 ruby -v -Itest test/cases/yaml_serialization_test.rb` the following warning shows up: `implementing to_yaml is deprecated, please implement "encode_with"`
* Keep the types of virtual columns after yaml serializationSean Griffin2014-06-101-1/+14
| | | | | On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us.
* New records should remain new after yaml serializationSean Griffin2014-06-011-0/+17
|
* Don't change values in `@raw_attributes` during serializationSean Griffin2014-06-011-7/+12
| | | | | | During `init_with`, the attributes given to the coder will be placed into `@raw_attributes`. As such, we should read from `@raw_attributes` when encoding, rather than `@attributes`, which has been type cast.
* Add test for ActiveRecord::Relation YAML serialization, for #5303 issueIvan Antropov2013-11-031-0/+4
|
* prevent global timezone state from leaking out of test cases.Yves Senn2013-10-251-10/+4
|
* No need to require psych since require yaml does that.Rafael Mendonça França2012-01-041-1/+0
|
* No need to use rescue block to require psychRafael Mendonça França2012-01-041-18/+14
|
* stop test resetting global stateJon Leighton2011-12-231-0/+6
|
* Add hackery to make Syck use encode_with/init_with. Fixes 1.8 after recent ↵Jon Leighton2011-12-011-0/+5
| | | | changes to attribute serialization.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* adding an `encode_with` method for Psych dump/load methodsAaron Patterson2011-01-051-0/+7
|
* make sure new objects can round tripAaron Patterson2011-01-051-0/+6
|
* make sure that Psych can roundtrip an AR objectAaron Patterson2011-01-051-0/+13
|
* adding a test for YAML round tripAaron Patterson2010-12-021-0/+9
|
* Added #to_i to DateTime in ActiveSupport so #to_yaml works correctly on ↵Serguei Filimonov2009-12-151-0/+11
ActiveRecord models with DateTime attributes.