aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/serialized_attribute_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* AR#reset_column_information sometimes queries via table_exists?Akira Matsuda2014-08-311-1/+1
| | | | so this assertion causes random test fail
* Document the change in `nil` handling for serialized attributesGodfrey Chan2014-07-151-9/+12
| | | | Also updated the test case to reflect that
* Fixed SQL syntax for postgresqlGodfrey Chan2014-07-151-1/+1
|
* Merge pull request #16162 from chancancode/fix_json_coderGodfrey Chan2014-07-151-0/+18
| | | | Fixed JSON coder when loading NULL from DB
* Revert "Revert "Merge pull request #16059 from jenncoop/json-serialized-attr""Godfrey Chan2014-07-151-1/+15
| | | | | | | This reverts commit 6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f. Conflicts: activerecord/CHANGELOG.md
* Revert "Merge pull request #16059 from jenncoop/json-serialized-attr"Godfrey Chan2014-07-051-15/+1
| | | | | | This reverts commit a03097759bd7103bb9db253e7ba095f011453f75. This needs more work before it would work correctly on master.
* Merge pull request #16059 from jenncoop/json-serialized-attrGodfrey Chan2014-07-051-1/+15
| | | | | | | | Fixed issue with ActiveRecord serialize object as JSON Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods/serialization.rb
* Deprecate `serialized_attributes` without replacementSean Griffin2014-06-141-2/+4
| | | | | We've stopped using it internally, in favor of polymorphism. So should you!
* Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-131-6/+0
| | | | | | | | | | | | | | | There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types
* Don't query the database schema when calling `serialize`Sean Griffin2014-06-071-0/+7
| | | | | | We need to decorate the types lazily. This is extracted to a separate API, as there are other refactorings that will be able to make use of it, and to allow unit testing the finer points more granularly.
* Bring type casting behavior of hstore/json in line with serializedSean Griffin2014-06-041-1/+1
| | | | | `@raw_attributes` should not contain the type-cast, mutable version of the value.
* Remove most code related to serialized propertiesSean Griffin2014-06-011-4/+7
| | | | | | | | | | | Nearly completely implemented in terms of custom properties. `_before_type_cast` now stores the raw serialized string consistently, which removes the need to keep track of "state". The following is now consistently true: - `model.serialized == model.reload.serialized` - A model can be dumped and loaded infinitely without changing - A model can be saved and reloaded infinitely without changing
* Update some bad test cases for serialized columnsSean Griffin2014-05-301-53/+17
| | | | | | | | | | | | The first case was not testing what the issue mentioned actually was (A subclass of a class with serialized attributes does not serialize when they come from the database). The second case was a bad coder. It would fail if the model was `dup`ed, or if the the model was loaded from the database and then saved again. The third case wasn't testing anything that wasn't covered by the second (and was also a bad coder for the same reasons as the second).
* Refactor serialized types to be partially defined as custom propertiesSean Griffin2014-05-291-10/+0
| | | | | | | Many of the methods defined in `AttributeMethods::Serialization` can be refactored onto this type as well, but this is a reasonable small step. Removes the `Type` class, and the need for `decorate_columns` to handle serialized types.
* Fix serialized field returning serialized data after update_columnSimon Eskildsen2014-04-051-0/+16
|
* Use teardown helper method.Guo Xiang Tan2014-03-141-2/+1
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* prevent global timezone state from leaking out of test cases.Yves Senn2013-10-251-8/+7
|
* Remove unnecessary loopVipul A M2013-09-131-5/+2
|
* Perf: avoid dupes add fallback logic for codersSam2013-09-111-1/+1
|
* Remove instance level serialized_attributes setting was deprecated.kennyj2013-06-021-6/+0
|
* Fix typo in serialized_attribute_test. [ci skip]Max Edmands2013-04-281-1/+1
|
* Added testcase for #10067 and a CHANGELOG entry about this change.kennyj2013-04-251-0/+14
|
* test case for `serialize` default values.Yves Senn2013-03-071-0/+7
| | | | Closes #9110
* Serialized attribute can be serialized in an integer columnRafael Mendonça França2012-12-211-1/+10
| | | | Fix #8575
* Fix decorating columns for serialized attributesitzki2012-12-101-0/+13
|
* Fix `attributes_before_type_cast` for serialised attributes.Nikita Afanasenko2012-10-311-3/+13
| | | | Public method `attributes_before_type_cast` used to return internal AR structure (ActiveRecord::AttributeMethods::Serialization::Attribute), patch fixes this. Now behaves like `read_attribute_before_type_cast` and returns unserialised values.
* Add test to ensure that save will raise SerializationTypeMismatch if theRafael Mendonça França2012-08-261-0/+6
| | | | serialized attribute value is not from the same class
* We don't need this reloadRafael Mendonça França2012-08-261-1/+1
|
* Use the Topic class in the attribute serialized testsRafael Mendonça França2012-08-261-8/+4
|
* Use teardown hook to return the initial state of the objectRafael Mendonça França2012-08-261-16/+5
|
* Move the serialized attribute tests to their own fileRafael Mendonça França2012-08-261-0/+214