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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dcab04bb1079556fb3f2f036a3e7d6a4ee423dc5d9ab31cb27ea41c4bbd4099
4
- data.tar.gz: c7b63e5946469731c3ecacd67d013d44928f635308c70118a91b07adddc82887
3
+ metadata.gz: ceee8d4f88ed9779af0975cfa040c264ff4a64e3b58267f7d75625c1c6ac10d2
4
+ data.tar.gz: 5ba7df198acb2aa147107d1ad423ced3e965d602c15248b8a367cc7c55ffab17
5
5
  SHA512:
6
- metadata.gz: ed12c7a3f09be0d82af29c7d47bc155a70c504c2f46370298e75e65fbad52706a3cf168f6a214d04f52b330f11c39b6404fd4a10de504cb646e33cfe0dbb6ff9
7
- data.tar.gz: 654294059fa0e7c7a07531b702797988f0f6bedc491496d2c8ee8c37a3083927e02d60b24dc9e315c5c605796d18ac7d23b33219e08748c324084a307ebdd02c
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
@@ -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', dependent: :nullify
24
+ has_many :traks, as: :item, class_name: 'Trakable::Trak'
25
25
 
26
26
  # Include revertable methods
27
27
  include ModelRevertable
@@ -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.instance_eval(&condition)
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.instance_eval(&condition)
59
+ condition && record.instance_exec(&condition)
59
60
  end
60
61
 
61
62
  def build_trak
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trakable
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trakable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hadrien Blanc