From 3a173678459d01c1b6d4622a5116867205df8788 Mon Sep 17 00:00:00 2001 From: Ben Atkins Date: Mon, 29 Dec 2014 14:55:04 -0500 Subject: [PATCH] close #416; Update CHANGELOG and README w/ instructions on how to use the new config option for SerializedAttribute support --- CHANGELOG.md | 6 ++++-- README.md | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f002d4ed..4572b9f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,12 @@ PaperTrail::Rails::Engine.eager_load! - [#438](https://github.com/airblade/paper_trail/issues/438) - `Model.paper_trail_enabled_for_model?` should return `false` if `has_paper_trail` has not been declared on the class. - [#427](https://github.com/airblade/paper_trail/pull/427) - Fix `reify` method in context of model where a column has been removed. + - [#416](https://github.com/airblade/paper_trail/issues/416) - Added a `config` option for enabling/disabling + utilization of `serialized_attributes` for `ActiveRecord`, necessary because `serialized_attributes` has been + deprecated in `ActiveRecord` version `4.2` and will be removed in version `5.0` - [#414](https://github.com/airblade/paper_trail/issues/414) - Fix functionality `ignore` argument to `has_paper_trail` in `ActiveRecord` 4. - - [#399](https://github.com/airblade/paper_trail/pull/399) - Add `:dup` argument for options hash to `reify` which forces a - new model instance. + - [#399](https://github.com/airblade/paper_trail/pull/399) - Add `:dup` argument for options hash to `reify` which forces a new model instance. - [#394](https://github.com/airblade/paper_trail/pull/394) - Add RSpec matcher `have_a_version_with` for easier testing. - [#391](https://github.com/airblade/paper_trail/issues/391) - `object_changes` value should dump to `YAML` as a normal `Hash` instead of an `ActiveSupport::HashWithIndifferentAccess`. diff --git a/README.md b/README.md index 2bb99c06..586b0834 100644 --- a/README.md +++ b/README.md @@ -943,6 +943,23 @@ A valid serializer is a `module` (or `class`) that defines a `load` and `dump` m * [PaperTrail::Serializers::YAML](https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/serializers/yaml.rb) - Default * [PaperTrail::Serializers::JSON](https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/serializers/json.rb) +## SerializedAttributes support + +PaperTrail has a config option that can be used to enable/disable whether PaperTrail attempts to utilize +`ActiveRecord`'s `serialized_attributes` feature. Note: This is enabled by default when PaperTrail is used +with `ActiveRecord` version < `4.2`, and disabled by default when used with ActiveRecord `4.2.x`. Since +`serialized_attributes` will be removed in `ActiveRecord` version `5.0`, this configuration value +has no functionality when PaperTrail is used with version `5.0` or greater. + +```ruby +# Enable support +>> PaperTrail.config.serialized_attributes = true +# Disable support +>> PaperTrail.config.serialzied_attributes = false +# Get current setting +>> PaperTrail.serialized_attributes? +``` + ## Limiting the number of versions created per object instance If you are wary of your `versions` table growing to an unwieldy size, or just don't care to track more than a certain number of versions per object,