aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/serialization.rb
Commit message (Collapse)AuthorAgeFilesLines
* Report the attribute on ActiveRecord::SerializationTypeMismatchKir Shatrov2017-01-291-1/+1
|
* [ci skip] Use right format textAndrey Molchanov2016-09-281-1/+1
|
* revises most Lint/EndAlignment offensesXavier Noria2016-08-071-5/+5
| | | | Some case expressions remain, need to think about those ones.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-1/+1
|
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-2/+2
| | | | | | | | | | | | | | | | | | | The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
* [ci skip] Fix rdoc markupakihiro172015-08-121-1/+1
|
* Copy-edits in 04c349659bfd97f9eaf5266ef7a64b4eb367c6a8Rafael Mendonça França2015-06-121-1/+2
|
* add doc about how empty serialization objects are persisted Diego Carrion2015-06-121-0/+2
| | | the test case for this commit is in cd3f5db
* Merge pull request #20364 from ernie/update-serialize-docsSean Griffin2015-05-291-0/+9
|\ | | | | | | | | | | Update docs for ActiveRecord `serialize` [ci skip]
| * Update docs for ActiveRecord `serialize`Ernie Miller2015-05-291-0/+9
|/ | | | | | | | | | | | For certain column types, using `serialize` is unnecessary, or the user may get unexpected contents back from the DB adapter (which is handling some basic deserialization for them). Call this out in the documentation. For background, see: https://gist.github.com/ernie/33f75f2294885b9806f9 https://twitter.com/erniemiller/status/604262907442905090
* Remove unneeded requiresRafael Mendonça França2015-01-041-2/+0
| | | | These requires were added only to change deprecation message
* Remove deprecated `serialized_attributes`Rafael Mendonça França2015-01-041-13/+0
|
* let's warn with heredocsXavier Noria2014-10-281-2/+6
| | | | | | | | | | | | The current style for warning messages without newlines uses concatenation of string literals with manual trailing spaces where needed. Heredocs have better readability, and with `squish` we can still produce a single line. This is a similar use case to the one that motivated defining `strip_heredoc`, heredocs are super clean.
* test, better describe `SerializationTypeMismatch` behavior. refs #14716.Yves Senn2014-10-161-2/+2
|
* docs, since #16702 we detect mutation on serialized attributes. [ci skip]Yves Senn2014-10-161-3/+0
| | | | /cc @sgrif
* Avoid using heredoc for user warningsGodfrey Chan2014-08-281-4/+3
| | | | | | | | | | Using heredoc would enforce line wrapping to whatever column width we decided to use in the code, making it difficult for the users to read on some consoles. This does make the source code read slightly worse and a bit more error-prone, but this seems like a fair price to pay since the primary purpose for these messages are for the users to read and the code will not stick around for too long.
* Revert "Revert "Merge pull request #16059 from jenncoop/json-serialized-attr""Godfrey Chan2014-07-151-1/+6
| | | | | | | This reverts commit 6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f. Conflicts: activerecord/CHANGELOG.md
* Revert "Merge pull request #16059 from jenncoop/json-serialized-attr"Godfrey Chan2014-07-051-6/+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/+6
| | | | | | | | Fixed issue with ActiveRecord serialize object as JSON Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/attribute_methods/serialization.rb
* Change the deprecation warning on `serialized_attributes`Sean Griffin2014-06-151-8/+2
| | | | to "without replacement"
* Deprecate `serialized_attributes` without replacementSean Griffin2014-06-141-16/+17
| | | | | We've stopped using it internally, in favor of polymorphism. So should you!
* Detect in-place changes on mutable AR attributesSean Griffin2014-06-131-17/+0
| | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* Don't query the database schema when calling `serialize`Sean Griffin2014-06-071-4/+2
| | | | | | 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.
* Refactor determination of whether the field has changedSean Griffin2014-06-031-8/+0
| | | | | The types know more about what is going on than the dirty module. Let's ask them!
* Remove most code related to serialized propertiesSean Griffin2014-06-011-51/+0
| | | | | | | | | | | 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
* Don't change values in `@raw_attributes` during serializationSean Griffin2014-06-011-1/+1
| | | | | | 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.
* Rename attribute related instance variables to better express intentSean Griffin2014-05-301-2/+2
| | | | | | | | | `@attributes` was actually used for `_before_type_cast` and friends, while `@attributes_cache` is the type cast version (and caching is the wrong word there, but I'm working on removing the conditionals around that). I opted for `@raw_attributes`, because `_before_type_cast` is also semantically misleading. The values in said hash are in the state given by the form builder or database, so raw seemed to be a good word.
* Move `type_cast_for_write` behavior over to the serialized type objectSean Griffin2014-05-291-37/+2
|
* Refactor serialized types to be partially defined as custom propertiesSean Griffin2014-05-291-20/+6
| | | | | | | 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.
* Add an interface for type objects to control Ruby => SQLSean Griffin2014-05-261-4/+2
| | | | | Adds the ability to save custom types, which type cast to non-primitive ruby objects.
* Merge pull request #14613 from Sirupsen/fix-serialize-update-columnRafael Mendonça França2014-05-211-0/+8
|\ | | | | | | | | | | | | Fix serialized field returning serialized data after update_column Conflicts: activerecord/CHANGELOG.md
| * Fix serialized field returning serialized data after update_columnSimon Eskildsen2014-04-051-0/+8
| |
* | docs, double meaning of `serialize` argument. Closes #14284.Yves Senn2014-04-141-5/+16
|/ | | | | | | | The second argument to serialize has double meaning: * `class_name` of the Type to serialize * `coder` to use then serializing. The new variable name and the docs better describe that behavior.
* AestheticRafael Mendonça França2014-01-291-6/+5
|
* Fixing issue with activerecord serialization not being able to dump a record ↵Mauricio Linhares2014-01-291-0/+11
| | | | after loading it from YAML - fixes #13861
* Move changed_attributes into dirty.rbKeenan Brock2014-01-221-0/+8
| | | Move serialization dirty into serialization.rb
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2013-11-071-0/+3
|\
| * warning about saving models with dirty attributesDamien Mathieu2013-10-231-0/+3
| | | | | | | | See #8328
* | `ActiveRecord::Store` works together with PG `hstore` columns.Yves Senn2013-10-251-0/+4
|/ | | | | | This is necessary because as of 5ac2341 `hstore` columns are always stored as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to be an instance of `HashWithIndifferentAccess`, which led to the bug.
* fix serialization type cast when value is already unserializedJan Berdajs2013-06-051-1/+5
|
* the typecast value should be passed to the serializer. fixes #10830Aaron Patterson2013-06-051-5/+5
|
* Remove instance level serialized_attributes setting was deprecated.kennyj2013-06-021-7/+0
|
* fix :nodoc: mark on AR::AttributeMethods::Serialization [ci skip]Francesco Rodriguez2013-04-121-2/+2
|
* update ActiveRecord::AttributeMethods::Serialization documentation [ci skip]Francesco Rodriguez2013-04-041-0/+7
|
* Serialized attribute can be serialized in an integer columnRafael Mendonça França2012-12-211-0/+8
| | | | Fix #8575
* Keep the code related to serialization in Serialization module.Nikita Afanasenko2012-11-101-1/+9
| | | | We should not need any `serialized_attributes` checks outside `ActiveRecord::AttributeMethods::Serialization` module.
* Fix `attributes_before_type_cast` for serialised attributes.Nikita Afanasenko2012-10-311-0/+10
| | | | 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.
* Make caller attribute in deprecation methods optionalAlexey Gaziev2012-10-301-1/+1
|
* Provide a call stack for deprecation warnings where needed.Nikita Afanasenko2012-10-291-1/+2
| | | | It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-09-281-8/+11
|\ | | | | | | | | Conflicts: actionpack/lib/action_view/helpers/asset_tag_helper.rb