ar_transaction_changes 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/.travis.yml +14 -0
- data/Appraisals +7 -0
- data/Rakefile +1 -0
- data/ar_transaction_changes.gemspec +4 -2
- data/gemfiles/rails32.gemfile +7 -0
- data/gemfiles/rails4.gemfile +7 -0
- data/lib/ar_transaction_changes.rb +6 -4
- data/lib/ar_transaction_changes/version.rb +1 -1
- metadata +48 -6
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ require 'ar_transaction_changes/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "ar_transaction_changes"
|
8
8
|
gem.version = ArTransactionChanges::VERSION
|
9
|
-
gem.authors = ["Dylan Smith"]
|
9
|
+
gem.authors = ["Dylan Thacker-Smith"]
|
10
10
|
gem.email = ["Dylan.Smith@shopify.com"]
|
11
11
|
gem.description = %q{Solves the problem of trying to get all the changes to an object during a transaction in an after_commit callbacks.}
|
12
12
|
gem.summary = %q{Store transaction changes for active record objects}
|
@@ -17,7 +17,9 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_dependency
|
20
|
+
gem.add_dependency "activerecord", "~> 3.0", "< 5.0"
|
21
21
|
|
22
|
+
gem.add_development_dependency("rake")
|
22
23
|
gem.add_development_dependency("mysql2")
|
24
|
+
gem.add_development_dependency("appraisal")
|
23
25
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
require "ar_transaction_changes/version"
|
2
2
|
|
3
3
|
module ArTransactionChanges
|
4
|
-
|
5
|
-
|
4
|
+
create_or_update_suffix = ActiveRecord::VERSION::MAJOR <= 3 ? "" : "_record"
|
5
|
+
|
6
|
+
define_method :"create#{create_or_update_suffix}" do |*args|
|
7
|
+
super(*args).tap do |status|
|
6
8
|
store_transaction_changed_attributes if status != false
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
10
|
-
|
11
|
-
super.tap do |status|
|
12
|
+
define_method :"update#{create_or_update_suffix}" do |*args|
|
13
|
+
super(*args).tap do |status|
|
12
14
|
store_transaction_changed_attributes if status != false
|
13
15
|
end
|
14
16
|
end
|
metadata
CHANGED
@@ -1,32 +1,54 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_transaction_changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Dylan Smith
|
8
|
+
- Dylan Thacker-Smith
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
- - <
|
20
23
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
24
|
+
version: '5.0'
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
|
+
- - <
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '5.0'
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
24
46
|
version_requirements: !ruby/object:Gem::Requirement
|
25
47
|
none: false
|
26
48
|
requirements:
|
27
49
|
- - ! '>='
|
28
50
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
51
|
+
version: '0'
|
30
52
|
- !ruby/object:Gem::Dependency
|
31
53
|
name: mysql2
|
32
54
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,6 +65,22 @@ dependencies:
|
|
43
65
|
- - ! '>='
|
44
66
|
- !ruby/object:Gem::Version
|
45
67
|
version: '0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: appraisal
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
46
84
|
description: Solves the problem of trying to get all the changes to an object during
|
47
85
|
a transaction in an after_commit callbacks.
|
48
86
|
email:
|
@@ -52,11 +90,15 @@ extensions: []
|
|
52
90
|
extra_rdoc_files: []
|
53
91
|
files:
|
54
92
|
- .gitignore
|
93
|
+
- .travis.yml
|
94
|
+
- Appraisals
|
55
95
|
- Gemfile
|
56
96
|
- LICENSE.txt
|
57
97
|
- README.md
|
58
98
|
- Rakefile
|
59
99
|
- ar_transaction_changes.gemspec
|
100
|
+
- gemfiles/rails32.gemfile
|
101
|
+
- gemfiles/rails4.gemfile
|
60
102
|
- lib/ar_transaction_changes.rb
|
61
103
|
- lib/ar_transaction_changes/version.rb
|
62
104
|
- test/database.yml.default
|