* 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>
* Drop support for ruby 2.3
* Docs: appraisal
* Drop support for rails <= 5.1
* Upgrade rubocop to 0.80
* Remove defunct code for EoL rails versions
* Rails 5+ style controller test params keyword
* Squash me
Co-Authored-By: Todd Lynam <TLynam@gmail.com>
Co-authored-by: Todd Lynam <TLynam@gmail.com>
This PR addresses #1015
Starting from Rails version 5.0.2 the default serializer of PostgreSQL columns returns an ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array object instead of a string. This new object is not suitable for JSON encoding and breaks versioning of any array fields backed by Postgres.
Whenever a PostgreSQL array is used, instead of asking Active Record for a serializer we introduce our own, which simply returns the underlying array without any modifications.
Fixes#798
Our test suite has one model that tests enums, PostWithStatus. Its
spec did not cover `touch_with_version`. Somehow, probably during
our upgrade to rails 5, we broke `touch_with_version` for enums.
Unlike other methods, when an enum arrives at
`CastAttributeSerializer#serialize` during `touch_with_version`, it
is already a number. We assumed it was always a string.
This is sort of a hack, just handling both strings and numbers in
`#serialize`. I'd rather figure out how a number got to `#serialize`
in the first place. However, a hack is acceptable, as it's only
for rails 4.2, and the hack will eventually be deleted when we
drop support for 4.2.
It already was organized *in memory* but now it's organized in files.
Also, there are six fewer methods being mixed into the model class
(they became ObjectAttribute and ObjectChangesAttribute).
I like how the legacy (rails < 4.2) support is now all in one file,
so it'll be really easy to drop when the time comes.
Finally, a minor thing, I renamed CastedAttributeSerializer to
CastAttributeSerializer, because I don't think "casted" is the
correct conjugation.