audit_log_vk 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: df1d9e69ffc1af41bc77961e10bc4b7914f5db29dd283186d0b6dd19e346ff47
4
- data.tar.gz: 2ca0bb840d2427ff623275d0bd4c37293080ef4fb04efaeafdabb57c359a784b
3
+ metadata.gz: 18c184154288a28e3cdfed59e120ac080e4bc8d9fa944ef2357cdaf350104522
4
+ data.tar.gz: fa59cd5dd8ec14250ca71d8b828f3579408858f52c22dab916032b213b4629c7
5
5
  SHA512:
6
- metadata.gz: 36e27ef44a58edc2e2f334d943eb4f411f9948fad4e0168df77db0a5ee879f0eca003094d60898e5c9df96ffcaa82276d2139da2e93619007ecd3d74eeeb1b75
7
- data.tar.gz: df0979b95450867bd5ed279f4809fdab9d7c613c1d7a78005773bad8a37d902280b0572f6bde7e36c4f8c9e2d0d58bed07a588442b93e6697490610a197e1eea
6
+ metadata.gz: 900b103f4ff37f503e620c0a0707d6140069a76c8aa60d7bb8d4aba3310d951d5ba611912dcefe9247b65a101387b9045ebdcdedce80940f6def9026e03be8f7
7
+ data.tar.gz: 184ede232d82f9ab6800cf783d52b356258b2280b30da35d411d326d2925cab809135ff2388492a582522d57d2bef9a52d9186d1016a1fed94e1bc80570e8dda
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/audit_log_vk.svg)](https://rubygems.org/gems/audit_log_vk)
2
+
3
+
1
4
  # AuditLog
2
5
 
3
6
  A lightweight, Rails-friendly audit logging gem to track model changes (`create`, `update`, `destroy`) with contextual metadata like `actor` and `reason`. Perfect for admin panels, SaaS apps, and audit trails.
@@ -20,8 +23,7 @@ A lightweight, Rails-friendly audit logging gem to track model changes (`create`
20
23
  Add this line to your application's Gemfile:
21
24
 
22
25
  ```ruby
23
- gem "audit_log", path: "path/to/your/local/gem"
24
- # or gem "audit_log" if published
26
+ gem "audit_log_vk"
25
27
  ```
26
28
  Then run:
27
29
  ```ruby
@@ -1,4 +1,5 @@
1
- # lib/audit_log/config.rb
1
+ # frozen_string_literal: true
2
+
2
3
  module AuditLog
3
4
  class << self
4
5
  attr_accessor :configuration
@@ -1,4 +1,5 @@
1
- # lib/audit_log/context.rb
1
+ # frozen_string_literal: true
2
+
2
3
  module AuditLog
3
4
  class Context
4
5
  THREAD_KEY = :audit_log_context
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "active_record"
3
4
 
4
5
  module AuditLog
@@ -8,8 +9,6 @@ module AuditLog
8
9
  belongs_to :auditable, polymorphic: true
9
10
  belongs_to :actor, polymorphic: true, optional: true
10
11
 
11
- # serialize :changed_data, coder: JSON
12
-
13
12
  validates :action, presence: true
14
13
  validates :auditable_type, :auditable_id, presence: true
15
14
 
@@ -1,13 +1,14 @@
1
- # lib/audit_log/helpers.rb
1
+ # frozen_string_literal: true
2
+
2
3
  module AuditLog
3
4
  module Helpers
4
- # Executes a block with the given audit context
5
+ # Sets temporary audit context (actor and reason) for the duration of the block.
5
6
  #
6
7
  # Example:
7
- # AuditLog.with_context(actor: current_user, reason: "Batch update") do
8
+ # AuditLog::Helpers.with_context(actor: current_user, reason: "Batch update") do
8
9
  # user.update!(name: "New")
9
10
  # end
10
- #
11
+
11
12
  def self.with_context(actor: nil, reason: nil)
12
13
  AuditLog::Context.actor = actor
13
14
  AuditLog::Context.reason = reason
@@ -1,4 +1,5 @@
1
- # lib/audit_log/model.rb
1
+ # frozen_string_literal: true
2
+
2
3
  require "active_support/concern"
3
4
 
4
5
  module AuditLog
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AuditLog
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/audit_log.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative "audit_log/version"
3
4
  require_relative "audit_log/config"
4
5
  require_relative "audit_log/context"
@@ -8,5 +9,4 @@ require_relative "audit_log/helpers"
8
9
 
9
10
  module AuditLog
10
11
  class Error < StandardError; end
11
- # Your code goes here...
12
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CreateAuditLogEntries < ActiveRecord::Migration[6.0]
2
4
  def change
3
5
  create_table :audit_log_entries do |t|
@@ -11,7 +13,7 @@ class CreateAuditLogEntries < ActiveRecord::Migration[6.0]
11
13
  t.timestamps
12
14
  end
13
15
 
14
- add_index :audit_log_entries, [:auditable_type, :auditable_id]
15
- add_index :audit_log_entries, [:actor_type, :actor_id]
16
+ add_index :audit_log_entries, %i[auditable_type auditable_id]
17
+ add_index :audit_log_entries, %i[actor_type actor_id]
16
18
  end
17
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audit_log_vk
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
  - viktor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-31 00:00:00.000000000 Z
11
+ date: 2025-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails