Commit Graph

9 Commits

Author SHA1 Message Date
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
Jared Beck de1dda4f79 Remove vestigial version conditionals 2021-03-21 01:07:08 -04:00
Jared Beck f92037c048
Prepare for v11 (#1235)
* 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>
2020-03-02 21:58:33 -05:00
Jared Beck cfbf7a647c Lint: Style/FrozenStringLiteralComment 2017-12-10 23:05:39 -05:00
Hubert Pompecki 4cce9b0179 Serializing postgres arrays (#1018)
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.
2017-12-08 11:44:40 -05:00
Jared Beck 9db3b3ce05 Delete LegacyActiveRecordShim 🎉
We no longer support rails < 4.2
2017-10-27 12:34:56 -04:00
Jared Beck 7884c143b6 Fix deserialization of enums written by PT 4
Fixes #855
2016-09-02 18:14:54 -04:00
Jared Beck bc1308ea80 Fix enum serialization in rails 4.2
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.
2016-08-14 00:24:13 -04:00
Jared Beck 10cabf2408 Break AttributesSerialization into small modules
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.
2016-05-18 23:12:45 -04:00