transaction_changes 2.0.1 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +2 -0
- data/Gemfile.lock +105 -5
- data/lib/transaction_changes/version.rb +1 -1
- data/lib/transaction_changes.rb +16 -6
- data/transaction_changes.gemspec +4 -0
- metadata +45 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 87555349d944f68fc8675579a3749f97809cb2ca2695bc44073c094183edc40f
|
4
|
+
data.tar.gz: e45fa2e5cd31fcc251cadebe1e2a5598fa467ac16f5fd67026a4275a46b7ea63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4696e4dcbc58633d5a8de757cfacf0d3bbf1ef6aaa8e4351396d7e44d7355716879b206bfa21009f52becaefa9165ac6d45ff8e4f5e4072a38690fb56be7940d
|
7
|
+
data.tar.gz: 52da1cca331d9097e26e95dd75c2c3eaea5fa4b87c337c55346e4d7cf928663536d832ac61a38db3238ef0e9e27973fb75f3c2e0bee7fd245e9260c39fc4cb4c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,108 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
transaction_changes (2.0)
|
4
|
+
transaction_changes (2.0.1)
|
5
|
+
activerecord
|
5
6
|
activesupport
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
|
11
|
-
|
11
|
+
actioncable (5.2.0)
|
12
|
+
actionpack (= 5.2.0)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.0)
|
16
|
+
actionpack (= 5.2.0)
|
17
|
+
actionview (= 5.2.0)
|
18
|
+
activejob (= 5.2.0)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.2.0)
|
22
|
+
actionview (= 5.2.0)
|
23
|
+
activesupport (= 5.2.0)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.2.0)
|
29
|
+
activesupport (= 5.2.0)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.2.0)
|
35
|
+
activesupport (= 5.2.0)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.2.0)
|
38
|
+
activesupport (= 5.2.0)
|
39
|
+
activerecord (5.2.0)
|
40
|
+
activemodel (= 5.2.0)
|
41
|
+
activesupport (= 5.2.0)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.0)
|
44
|
+
actionpack (= 5.2.0)
|
45
|
+
activerecord (= 5.2.0)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.0)
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
|
+
i18n (>= 0.7, < 2)
|
12
50
|
minitest (~> 5.1)
|
13
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
14
51
|
tzinfo (~> 1.1)
|
52
|
+
arel (9.0.0)
|
53
|
+
builder (3.2.3)
|
54
|
+
byebug (10.0.2)
|
15
55
|
concurrent-ruby (1.0.5)
|
56
|
+
crass (1.0.4)
|
16
57
|
diff-lcs (1.3)
|
17
|
-
|
58
|
+
erubi (1.7.1)
|
59
|
+
globalid (0.4.1)
|
60
|
+
activesupport (>= 4.2.0)
|
61
|
+
i18n (1.0.1)
|
18
62
|
concurrent-ruby (~> 1.0)
|
63
|
+
loofah (2.2.2)
|
64
|
+
crass (~> 1.0.2)
|
65
|
+
nokogiri (>= 1.5.9)
|
66
|
+
mail (2.7.0)
|
67
|
+
mini_mime (>= 0.1.1)
|
68
|
+
marcel (0.3.2)
|
69
|
+
mimemagic (~> 0.3.2)
|
70
|
+
method_source (0.9.0)
|
71
|
+
mimemagic (0.3.2)
|
72
|
+
mini_mime (1.0.0)
|
73
|
+
mini_portile2 (2.3.0)
|
19
74
|
minitest (5.11.3)
|
75
|
+
mysql2 (0.5.1)
|
76
|
+
nio4r (2.3.1)
|
77
|
+
nokogiri (1.8.2)
|
78
|
+
mini_portile2 (~> 2.3.0)
|
79
|
+
rack (2.0.5)
|
80
|
+
rack-test (1.0.0)
|
81
|
+
rack (>= 1.0, < 3)
|
82
|
+
rails (5.2.0)
|
83
|
+
actioncable (= 5.2.0)
|
84
|
+
actionmailer (= 5.2.0)
|
85
|
+
actionpack (= 5.2.0)
|
86
|
+
actionview (= 5.2.0)
|
87
|
+
activejob (= 5.2.0)
|
88
|
+
activemodel (= 5.2.0)
|
89
|
+
activerecord (= 5.2.0)
|
90
|
+
activestorage (= 5.2.0)
|
91
|
+
activesupport (= 5.2.0)
|
92
|
+
bundler (>= 1.3.0)
|
93
|
+
railties (= 5.2.0)
|
94
|
+
sprockets-rails (>= 2.0.0)
|
95
|
+
rails-dom-testing (2.0.3)
|
96
|
+
activesupport (>= 4.2.0)
|
97
|
+
nokogiri (>= 1.6)
|
98
|
+
rails-html-sanitizer (1.0.4)
|
99
|
+
loofah (~> 2.2, >= 2.2.2)
|
100
|
+
railties (5.2.0)
|
101
|
+
actionpack (= 5.2.0)
|
102
|
+
activesupport (= 5.2.0)
|
103
|
+
method_source
|
104
|
+
rake (>= 0.8.7)
|
105
|
+
thor (>= 0.18.1, < 2.0)
|
20
106
|
rake (10.5.0)
|
21
107
|
rspec (3.7.0)
|
22
108
|
rspec-core (~> 3.7.0)
|
@@ -31,15 +117,29 @@ GEM
|
|
31
117
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
118
|
rspec-support (~> 3.7.0)
|
33
119
|
rspec-support (3.7.1)
|
120
|
+
sprockets (3.7.1)
|
121
|
+
concurrent-ruby (~> 1.0)
|
122
|
+
rack (> 1, < 3)
|
123
|
+
sprockets-rails (3.2.1)
|
124
|
+
actionpack (>= 4.0)
|
125
|
+
activesupport (>= 4.0)
|
126
|
+
sprockets (>= 3.0.0)
|
127
|
+
thor (0.20.0)
|
34
128
|
thread_safe (0.3.6)
|
35
129
|
tzinfo (1.2.5)
|
36
130
|
thread_safe (~> 0.1)
|
131
|
+
websocket-driver (0.7.0)
|
132
|
+
websocket-extensions (>= 0.1.0)
|
133
|
+
websocket-extensions (0.1.3)
|
37
134
|
|
38
135
|
PLATFORMS
|
39
136
|
ruby
|
40
137
|
|
41
138
|
DEPENDENCIES
|
42
139
|
bundler (~> 1.16)
|
140
|
+
byebug
|
141
|
+
mysql2
|
142
|
+
rails (~> 5.2.0.beta1)
|
43
143
|
rake (~> 10.0)
|
44
144
|
rspec (~> 3.0)
|
45
145
|
transaction_changes!
|
data/lib/transaction_changes.rb
CHANGED
@@ -1,28 +1,38 @@
|
|
1
1
|
require "transaction_changes/version"
|
2
2
|
require 'active_support/concern'
|
3
|
+
require "active_support/callbacks"
|
3
4
|
|
4
5
|
module TransactionChanges
|
5
6
|
extend ActiveSupport::Concern
|
7
|
+
include ActiveSupport::Callbacks
|
6
8
|
|
7
9
|
included do
|
8
|
-
after_commit -> { reset_transaction_changes }
|
9
10
|
after_save -> { accumulate_changes }
|
11
|
+
set_callback :commit, :before, :setting_variables
|
12
|
+
end
|
13
|
+
|
14
|
+
def setting_variables
|
15
|
+
@new_transaction_changes, @old_transaction_changes = HashWithIndifferentAccess.new, @new_transaction_changes
|
10
16
|
end
|
11
17
|
|
12
18
|
def transaction_changes
|
13
19
|
@old_transaction_changes || HashWithIndifferentAccess.new
|
14
20
|
end
|
15
21
|
|
22
|
+
def _run_rollback_callbacks
|
23
|
+
super
|
24
|
+
ensure
|
25
|
+
@old_transaction_changes = HashWithIndifferentAccess.new
|
26
|
+
end
|
27
|
+
|
16
28
|
private
|
29
|
+
|
17
30
|
def accumulate_changes
|
18
31
|
@new_transaction_changes ||= HashWithIndifferentAccess.new
|
19
|
-
|
20
|
-
|
32
|
+
attribute_changes = ::ActiveRecord.version.to_s.to_f >= 5.1 ? self.saved_changes : self.changes
|
33
|
+
attribute_changes.each do |key, value|
|
21
34
|
@new_transaction_changes[key] = value
|
22
35
|
end
|
23
36
|
end
|
24
37
|
|
25
|
-
def reset_transaction_changes
|
26
|
-
@new_transaction_changes, @old_transaction_changes = HashWithIndifferentAccess.new, @new_transaction_changes
|
27
|
-
end
|
28
38
|
end
|
data/transaction_changes.gemspec
CHANGED
@@ -27,4 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
29
|
spec.add_dependency "activesupport"
|
30
|
+
spec.add_dependency "activerecord"
|
31
|
+
spec.add_development_dependency "mysql2"
|
32
|
+
spec.add_development_dependency "byebug"
|
33
|
+
|
30
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transaction_changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Priyanka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,48 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activerecord
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mysql2
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
69
111
|
description: Store attribute changes during ActiveRecord Transaction
|
70
112
|
email:
|
71
113
|
- priyankatrancedi.iitd@gmail.com
|
@@ -107,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
149
|
version: '0'
|
108
150
|
requirements: []
|
109
151
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.7.7
|
111
153
|
signing_key:
|
112
154
|
specification_version: 4
|
113
155
|
summary: Store attribute changes during ActiveRecord Transaction
|