effective_resources 2.30.0 → 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: 90df98c5f5d1a618fc2bc4a0ca4dc4a48a2d2b1464295258d489e77c90a495e8
4
- data.tar.gz: 1e68120f9b3eff24664b401b09fafaf0fe799ce8bd5da03f47398958b69e700f
3
+ metadata.gz: a7cbfc6f6ed5a78035d8bf09bc3c0c2805926fab8e09b374a0a69ccc99fd5b68
4
+ data.tar.gz: 0a5c3c5ef964a9b35f7cb3cc04168b62fb4a96fe48b136de17898f6029cf5ca3
5
5
  SHA512:
6
- metadata.gz: 8480ea5fc56d57afc54874d53d095a5d2df354e9c75df35ef0774387e41fca1503989f831170fce558a41d23fc4007ac724238c8a4b45f03875524ec2ad6ea49
7
- data.tar.gz: '0392e670ebc5e8b46688f1f5c31c0db82bb77f9622bb46b8ac6fee7adb625a2f2a94e4763181f07bb0865f3937a0389442367a2be691c45e2df2976bfa096c45'
6
+ metadata.gz: 1a7d51930c1956ca7764c0cd7e810d18d802220eb34cdb3802ea5c07e0fab062bb954c00c7366033393a8ac39e14e5397c0f660e23bf566a20260efd83ac449a
7
+ data.tar.gz: 79b9aa4c4f241ceb20a3b543653c21605754786baa556869c65c6984c74477fcca9b6843ed50f56388c0355f7661e026aecdf58480de7d0bf77154b623e4e162
@@ -267,6 +267,10 @@ module EffectiveResourcesHelper
267
267
  controller.class.try(:effective_wizard_controller?) && defined?(resource) && resource.draft?
268
268
  end
269
269
 
270
+ def admin_namespace?
271
+ controller.request.path.start_with?('/admin/')
272
+ end
273
+
270
274
  def wizard_card(resource, &block)
271
275
  raise('expected a block') unless block_given?
272
276
  raise('expected an acts_as_wizard resource') unless resource.class.respond_to?(:acts_as_wizard?)
@@ -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.0'.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.0
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-05-16 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