mongoid-auditor 0.1.0 → 0.1.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: 869c768a48b7fb7e52b1d437b89b484f72cc397dd74b0416c229088c6967189e
4
- data.tar.gz: e1b3f3f5c59eb810af348dad24268b6b06fa1dbe2874c9c631b4d15a19463908
3
+ metadata.gz: 2aa7ebf81ba4781aef853bf48e5fa096de08e532df7744c0bb2de5084e9b9bfb
4
+ data.tar.gz: 75f6100cf88e0490121e6758c08c690685136da4a0c7d96ab1f39055bccef9e7
5
5
  SHA512:
6
- metadata.gz: 0200e27d63508fb92aabc155a487497720e0657de998b3ae15ec41f787aed92d94e02bbfcd0ba9ed5d62e3603f8ab37652ab45053eb17a759e84a97843abbffa
7
- data.tar.gz: e4c4d32d87f3b4f07b68dac2caad98aceb2bab67dcdd461328b35ea52730155f97c5defd341b41fcc2698ffcde0692000cf634dda24bdfcadd27e89686c6dcd7
6
+ metadata.gz: e92739869c96d293ed5a8faa1ec7089546a4a4975e5e645dad1cf3451d1722299a438619e4b3e6617b375f60248a92b77e9b0738b37419b797b634697f906f86
7
+ data.tar.gz: ef29f674dd7d5a5a43ff289709f715e8b386131d405311cf0bd33818bcd3c9343dd204a0d87e3a52118341c0050d774656e167ea0b2c2dbccdca37d3252fc108
data/CHANGELOG.md CHANGED
@@ -3,3 +3,7 @@
3
3
  ## [0.1.0] - 2025-12-24
4
4
 
5
5
  - Initial release
6
+
7
+ ## [0.1.1] - 2025-12-25
8
+ ### Fix
9
+ - Avoided method name collision with Mongoid/ActiveModel by renaming auditor `errors` helper to `audit_errors`.
@@ -11,7 +11,7 @@ module Mongoid
11
11
 
12
12
  class_methods do
13
13
  # All audit logs that represent errors
14
- def errors
14
+ def audit_errors
15
15
  where(has_error: true)
16
16
  end
17
17
 
@@ -37,22 +37,22 @@ module Mongoid
37
37
 
38
38
  # Errors created today
39
39
  def errors_today
40
- errors.where(created_at: Time.current.all_day)
40
+ audit_errors.where(created_at: Time.current.all_day)
41
41
  end
42
42
 
43
43
  # Errors created in last N days
44
44
  def errors_last(days)
45
- errors.where(:created_at.gte => days.days.ago)
45
+ audit_errors.where(:created_at.gte => days.days.ago)
46
46
  end
47
47
 
48
48
  # Errors by specific actor
49
49
  def errors_by(actor_id)
50
- errors.where(actor: actor_id)
50
+ audit_errors.where(actor: actor_id)
51
51
  end
52
52
 
53
53
  # Quick summary: class names and counts
54
54
  def error_summary
55
- errors.group_by { |log| log.error&.dig('class') || 'Unknown' }.transform_values(&:count)
55
+ audit_errors.group_by { |log| log.error&.dig('class') || 'Unknown' }.transform_values(&:count)
56
56
  end
57
57
 
58
58
  def error_summary_today
@@ -41,7 +41,7 @@ module Mongoid
41
41
  ::Mongoid::Auditor::AuditLog.where(model_type: self.class.name, event: event, created_at: today_time)
42
42
  end
43
43
 
44
- def error
44
+ def audit_error
45
45
  ::Mongoid::Auditor::AuditLog.where(model_id: id.to_s, model_type: self.class.name, has_error: true)
46
46
  end
47
47
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mongoid
4
4
  module Auditor
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-auditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pralad Mishra