trakable 0.2.0 → 0.2.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 +14 -0
- data/Rakefile +7 -1
- data/lib/trakable/model.rb +1 -1
- data/lib/trakable/tracker.rb +3 -2
- data/lib/trakable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ceee8d4f88ed9779af0975cfa040c264ff4a64e3b58267f7d75625c1c6ac10d2
|
|
4
|
+
data.tar.gz: 5ba7df198acb2aa147107d1ad423ced3e965d602c15248b8a367cc7c55ffab17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4ec5821a5adf1471e78494ab0097ab597c80891600aeb9355a0316c3d98ad9e6956c1b60253a059716086a8a255317ac3bdb092b96bde8b38f0e02fb08f6ffb
|
|
7
|
+
data.tar.gz: 457ef5389261ccf7e26c67bd804e01a928b6c18a07534e6ef4ca8e1fed9981f773972e0247c03d49a6ed55e5308b3f818b78557e924acded1746241586fbf27f
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.1] - 2026-03-20
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Remove `dependent: :nullify`** on traks association — traks now survive record destruction (was crashing on destroy due to NOT NULL constraint)
|
|
13
|
+
- **Skip empty changeset traks** — updating only non-tracked attributes no longer creates a trak with an empty changeset
|
|
14
|
+
- **Use `instance_exec` for `if:`/`unless:` conditions** — lambdas with strict arity checking now work correctly
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **100 integration tests** with real ActiveRecord + SQLite covering lifecycle, filtering, conditional tracking, scopes, reify, revert, cleanup, transactions, STI, and more
|
|
19
|
+
- **Release workflow** — gem is auto-published to RubyGems on tag push
|
|
20
|
+
|
|
8
21
|
## [0.2.0] - 2026-03-20
|
|
9
22
|
|
|
10
23
|
### Added
|
|
@@ -46,5 +59,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
46
59
|
- Comprehensive README with usage examples
|
|
47
60
|
- MIT License
|
|
48
61
|
|
|
62
|
+
[0.2.1]: https://github.com/hadrienblanc/trakable/releases/tag/v0.2.1
|
|
49
63
|
[0.2.0]: https://github.com/hadrienblanc/trakable/releases/tag/v0.2.0
|
|
50
64
|
[0.1.0]: https://github.com/hadrienblanc/trakable/releases/tag/v0.1.0
|
data/Rakefile
CHANGED
|
@@ -6,7 +6,13 @@ require 'rake/testtask'
|
|
|
6
6
|
Rake::TestTask.new(:test) do |t|
|
|
7
7
|
t.libs << 'test'
|
|
8
8
|
t.libs << 'lib'
|
|
9
|
-
t.pattern = 'test/**/*_test.rb'
|
|
9
|
+
t.pattern = 'test/{trakable,generators}/**/*_test.rb'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Rake::TestTask.new(:test_integration) do |t|
|
|
13
|
+
t.libs << 'test'
|
|
14
|
+
t.libs << 'lib'
|
|
15
|
+
t.pattern = 'test/integration_test.rb'
|
|
10
16
|
end
|
|
11
17
|
|
|
12
18
|
task default: :test
|
data/lib/trakable/model.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Trakable
|
|
|
21
21
|
class_attribute :trakable_options, instance_writer: false, default: {}
|
|
22
22
|
|
|
23
23
|
# has_many :traks association
|
|
24
|
-
has_many :traks, as: :item, class_name: 'Trakable::Trak'
|
|
24
|
+
has_many :traks, as: :item, class_name: 'Trakable::Trak'
|
|
25
25
|
|
|
26
26
|
# Include revertable methods
|
|
27
27
|
include ModelRevertable
|
data/lib/trakable/tracker.rb
CHANGED
|
@@ -24,6 +24,7 @@ module Trakable
|
|
|
24
24
|
def call
|
|
25
25
|
return unless tracking_enabled?
|
|
26
26
|
return if skip?
|
|
27
|
+
return if event == 'update' && changeset.empty?
|
|
27
28
|
|
|
28
29
|
build_trak
|
|
29
30
|
end
|
|
@@ -50,12 +51,12 @@ module Trakable
|
|
|
50
51
|
|
|
51
52
|
def skip_if_condition?
|
|
52
53
|
condition = record.trakable_options[:if]
|
|
53
|
-
condition && !record.
|
|
54
|
+
condition && !record.instance_exec(&condition)
|
|
54
55
|
end
|
|
55
56
|
|
|
56
57
|
def skip_unless_condition?
|
|
57
58
|
condition = record.trakable_options[:unless]
|
|
58
|
-
condition && record.
|
|
59
|
+
condition && record.instance_exec(&condition)
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
def build_trak
|
data/lib/trakable/version.rb
CHANGED