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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccf66f61ae488422b3d515b215511b3a0be62d10d72c56123a175ff779666782
4
- data.tar.gz: 1ee14dcf4a39545056630e5793bc4928eb7096225c61c2eb8b3588a0c3067789
3
+ metadata.gz: e68600515b09d6a74e37e5f192337e3de577f002995460d10f89e49faba5d952
4
+ data.tar.gz: ed2bbb98d79b193bd2008ef4f74b323b34b7da58e56830543c78e0690173e2f8
5
5
  SHA512:
6
- metadata.gz: 8b5fe7f97a7ccecf276d2657af7c530f594fa64aef1eff9b0d38b05139cd050d62f7423944ba8e69baf42bd30e52504c4a40b05e1e0fb13caa17bf287c2c1fef
7
- data.tar.gz: 442edaf6a0ed84cd1486cb5e297448d93726271b1c4452bfb0ca01443023f760983f438bd42be19e985a15e622f0e9050f80a9bae69b2b74527cbd174e11c3ef
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 serialized forms. Order is significant.
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
- serialize(new_value) != raw_old_value
134
+ deserialize(raw_old_value) != cast(new_value)
130
135
  end
131
136
  end
132
137
 
@@ -3,6 +3,6 @@
3
3
  module Unmagic
4
4
  class Enum
5
5
  # Current version of the unmagic-enum gem
6
- VERSION = "0.3.0"
6
+ VERSION = "0.3.1"
7
7
  end
8
8
  end
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.0
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-06-12 00:00:00.000000000 Z
11
+ date: 2026-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport