actify 1.0.0 → 1.0.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: c2913716ba42355268f383ec908eb7b7cea22f1929512b636b2b183c9fd68181
4
- data.tar.gz: 5ec5793bc6ef9eabafac9940ad991149ff07d1e1b883d91d48060cd17ae9a137
3
+ metadata.gz: db8b33dd7b2f9adbf5075e1a468a078e9790ae58e8d3b1794a683e0942645d6a
4
+ data.tar.gz: b12f8c7f50427d65d13274928d39993fa45f5b92e12fafa881c7b3cdf2badbc3
5
5
  SHA512:
6
- metadata.gz: 0dae8c31d8c79c6f1c4e2562bf09ee50284770cc38e8d23dc2b1dd5431ecc897ee55b5dd7d4c24b826df624dbf1e3f587f21db06411f56ccba004a23fa90ae05
7
- data.tar.gz: b8233cefc428c863087171bc27f93625651987eb88e311e9f18f32c7758cf270783f0791d3fb0732ebbebd618a670201660b163c48afca2dbfb05f9c37230b5e
6
+ metadata.gz: 33cd3b5d55aa2b1c1d18c417edaf97eb9fc2a51c27c2eaf4d1e363fe36b588da51c2b9de60f5f138f2d301378f25e83c2cea1abfb2785ef0dbf3ad03149d16b4
7
+ data.tar.gz: 2a928012168cbef71539306ec233acc3c6d36f527be665f7ac19b14c541919203c82981e223427f644eae02ba9e418c570e091203dfbb9c5c5ba49f1266a6c53
@@ -2,5 +2,5 @@ class ActionLog < ApplicationRecord
2
2
  belongs_to :actor, class_name: "User"
3
3
  belongs_to :actionable, polymorphic: true
4
4
 
5
- enum status: %i[created aborted finished failed]
5
+ enum :status, [ :created, :aborted, :finished, :failed ]
6
6
  end
@@ -1,21 +1,22 @@
1
1
  class CreateActionLogs < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :action_logs do |t|
4
- t.string :status
5
- t.string :actor_id
4
+ t.integer :status, null: false
5
+ t.integer :actor_id
6
6
  t.string :action_code
7
7
  t.string :actionable_type
8
- t.string :actionable_id
8
+ t.integer :actionable_id
9
9
  t.string :action_label
10
10
  t.text :action_data
11
11
  t.text :context
12
12
  t.text :object_before
13
13
  t.text :object_after
14
+ t.text :error
14
15
 
15
16
  t.timestamps
16
17
  end
17
18
 
18
- add_index :action_logs, [:actionable_type, :actionable_id]
19
+ add_index :action_logs, [ :actionable_type, :actionable_id ]
19
20
  add_index :action_logs, :actor_id
20
21
  end
21
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Actify
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
data/lib/action.rb CHANGED
@@ -99,7 +99,7 @@ class Action # rubocop:disable Metrics/ClassLength,Style/Documentation
99
99
  log
100
100
  end
101
101
 
102
- def finalize_action_log(log, object, context)
102
+ def finalize_action_log(log, object, context) # rubocop:disable Metrics/AbcSize
103
103
  object_before = {}
104
104
  object_after = {}
105
105
 
@@ -108,8 +108,8 @@ class Action # rubocop:disable Metrics/ClassLength,Style/Documentation
108
108
  object_after[k] = v[1]
109
109
  end
110
110
 
111
- log.object_before = object_before
112
- log.object_after = object_after
111
+ log.object_before = object_before.as_json.to_s
112
+ log.object_after = object_after.as_json.to_s
113
113
 
114
114
  instance_exec(log, object, context, &hdl_finalize) if hdl_finalize
115
115
 
@@ -148,8 +148,7 @@ class Action # rubocop:disable Metrics/ClassLength,Style/Documentation
148
148
  action_code: code,
149
149
  action_label: label,
150
150
  action_data: context.data.to_s,
151
- context: context.to_s,
152
- object_before: object.to_s
151
+ context: context.to_s
153
152
  )
154
153
  end
155
154
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nguyenta99
@@ -34,10 +34,11 @@ files:
34
34
  - lib/actify/version.rb
35
35
  - lib/action.rb
36
36
  - sig/actify.rbs
37
- homepage: https://nguyenta99.com
37
+ homepage: https://github.com/nguyenta99/actify
38
38
  licenses:
39
39
  - MIT
40
- metadata: {}
40
+ metadata:
41
+ source_code_uri: https://github.com/nguyenta99/actify
41
42
  post_install_message:
42
43
  rdoc_options: []
43
44
  require_paths: