Commit Graph

2 Commits

Author SHA1 Message Date
Jared Beck d17fdabd29 Default serializer will use YAML.safe_load
Breaking change.

Going forward, PT's default serializer (PaperTrail::Serializers::YAML)
will use `safe_load` unless `ActiveRecord.use_yaml_unsafe_load`.

PT users are required to configure `ActiveRecord.yaml_column_permitted_classes`
correctly for their own application. Users may want to start with the following
safe-list:

```ruby
::ActiveRecord.use_yaml_unsafe_load = false
::ActiveRecord.yaml_column_permitted_classes = [
  ::ActiveRecord::Type::Time::Value,
  ::ActiveSupport::TimeWithZone,
  ::ActiveSupport::TimeZone,
  ::BigDecimal,
  ::Date,
  ::Symbol,
  ::Time
]
```
2022-08-15 21:52:29 -04:00
David Furber c10a8573f1
Rails 7.0 Compatibility (#1365)
* Make paper_trail work with Rails 7.0

* from class_methods do back to module ClassMethods

* add spec for PostgresArraySerializer to boost coverage

* lint the spec for PostgresArraySerializer

* lint the spec for PostgresArraySerializer again

* and now make that linted spec pass again

* test object change scopes a bit

* round out json and jsonb testing of object scopes

* test some other code paths to increase coverage

* linting

* linting

* mess with yaml loading in test

* oddball cop for double quotes

* use Rails public API for compatibility rather than instance_variable_set

Co-authored-by: dfurber <dfurber@truecar.com>
2022-01-21 00:10:53 -05:00