effective_resources 2.30.1 → 2.30.2

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: 4886d8d30dea773068dc36c2be6d6ff48134040f394cea743c42a8ead0aec6b3
4
- data.tar.gz: 68c0fa5dfcf86b4a0d16a11654ffebd4cd11bfd7ea0200c05e31e11a4dae1c15
3
+ metadata.gz: a7cbfc6f6ed5a78035d8bf09bc3c0c2805926fab8e09b374a0a69ccc99fd5b68
4
+ data.tar.gz: 0a5c3c5ef964a9b35f7cb3cc04168b62fb4a96fe48b136de17898f6029cf5ca3
5
5
  SHA512:
6
- metadata.gz: '0898275a175dc95fdc3da70c709bba58220c4fb56402cab97b39fe696de9ae4b960991d349a8e9c6d72d79a545e42220ecb73500a00ec29adce06a9feb468992'
7
- data.tar.gz: 4a28fce349b2971fbeb548938452cbbf45f4c301bb8c7864119716a5b4eab7d07e09352ca78ccfd50b8a194a75365892d288e8d59f1e6122e5c9eb69e3378a6f
6
+ metadata.gz: 1a7d51930c1956ca7764c0cd7e810d18d802220eb34cdb3802ea5c07e0fab062bb954c00c7366033393a8ac39e14e5397c0f660e23bf566a20260efd83ac449a
7
+ data.tar.gz: 79b9aa4c4f241ceb20a3b543653c21605754786baa556869c65c6984c74477fcca9b6843ed50f56388c0355f7661e026aecdf58480de7d0bf77154b623e4e162
@@ -45,22 +45,22 @@ module ActsAsStatused
45
45
  before_validation do
46
46
  self.status ||= all_statuses.first
47
47
 
48
- # Set an existing belongs_to automatically
49
- if respond_to?("#{status}_by") && send("#{status}_by").blank?
50
- self.send("#{status}_by=", current_user)
51
- end
52
-
53
48
  # Set an existing timestamp automatically
54
49
  if respond_to?("#{status}_at") && send("#{status}_at").blank?
55
50
  self.send("#{status}_at=", Time.zone.now)
56
51
  end
57
52
 
58
- if current_user.present?
59
- self.status_steps["#{status}_by_id".to_sym] ||= current_user.id
60
- self.status_steps["#{status}_by_type".to_sym] ||= current_user.class.name
53
+ self.status_steps["#{status}_at".to_sym] ||= Time.zone.now
54
+ end
55
+
56
+ before_validation(if: -> { status_changed? && current_user.present? }) do
57
+ # Set an existing belongs_to automatically
58
+ if respond_to?("#{status}_by") && send("#{status}_by").blank?
59
+ self.send("#{status}_by=", current_user)
61
60
  end
62
61
 
63
- self.status_steps["#{status}_at".to_sym] ||= Time.zone.now
62
+ self.status_steps["#{status}_by_id".to_sym] ||= current_user.id
63
+ self.status_steps["#{status}_by_type".to_sym] ||= current_user.class.name
64
64
  end
65
65
 
66
66
  validates :status, presence: true, inclusion: { in: const_get(:STATUSES).map(&:to_s) }
@@ -103,6 +103,7 @@ module Effective
103
103
  changes = instance.previous_changes.symbolize_keys.delete_if do |attribute, (before, after)|
104
104
  begin
105
105
  (before.kind_of?(ActiveSupport::TimeWithZone) && after.kind_of?(ActiveSupport::TimeWithZone) && before.to_i == after.to_i) ||
106
+ (before.kind_of?(Hash) && after.kind_of?(Hash) && before == after) ||
106
107
  (before == nil && after == false) || (before == nil && after == ''.freeze)
107
108
  rescue => e
108
109
  true
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.30.1'.freeze
2
+ VERSION = '2.30.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.30.1
4
+ version: 2.30.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-13 00:00:00.000000000 Z
11
+ date: 2025-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails