unmagic-enum 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/unmagic/enum/active_record_extensions.rb +7 -2
- data/lib/unmagic/enum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e68600515b09d6a74e37e5f192337e3de577f002995460d10f89e49faba5d952
|
|
4
|
+
data.tar.gz: ed2bbb98d79b193bd2008ef4f74b323b34b7da58e56830543c78e0690173e2f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0f659e46165feea78f11c05acd4350f6f4880ccb529a59ced02aa81ff0be583d706cfb540bc2227b0789790a83321516a4d8ed6f40e96513f4ab4461bde3854
|
|
7
|
+
data.tar.gz: 6b523a02f77243db8483308ce5e3ed5b8fcb14acbc3d3098f17b7d68c9594acd7c1231a6840f77dcaf6a3649ddfbe44863ab7d03dd84995d3329cbd2bcd7388e
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-08-27
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- `ArrayColumnType#changed_in_place?` compared `ActiveSupport::JSON.encode`'s compact serialization against the database's raw text, so any formatting difference — PostgreSQL's `jsonb` prints `["a", "b"]` with a space after each comma — flagged every multi-element record as changed the moment it loaded (dirtying `changes`/`saved_changes` and rewriting the column on every save). It now compares the deserialized raw value against the cast value, which also stops a stored value the enum no longer recognises (dropped on read) from marking an unmutated record as changed.
|
|
14
|
+
|
|
10
15
|
## [0.3.0] - 2026-06-12
|
|
11
16
|
|
|
12
17
|
### Added
|
|
@@ -124,9 +124,14 @@ module Unmagic
|
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
# Detect in-place mutation (e.g. `record.statuses << Status::ACTIVE`)
|
|
127
|
-
# by comparing the
|
|
127
|
+
# by comparing what the raw database value reads as against the current
|
|
128
|
+
# value. Order is significant. Deliberately not a string comparison of
|
|
129
|
+
# serialized forms: the database's own text rendering of a JSON document
|
|
130
|
+
# (e.g. PostgreSQL jsonb prints `["a", "b"]` with spaces) never matches
|
|
131
|
+
# ActiveSupport::JSON.encode's compact form, which would flag every
|
|
132
|
+
# multi-element record as changed the moment it loads.
|
|
128
133
|
def changed_in_place?(raw_old_value, new_value)
|
|
129
|
-
|
|
134
|
+
deserialize(raw_old_value) != cast(new_value)
|
|
130
135
|
end
|
|
131
136
|
end
|
|
132
137
|
|
data/lib/unmagic/enum/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unmagic-enum
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Keith Pitt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-08-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|