deep_cloneable 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/Appraisals +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +1 -0
- data/VERSION +1 -1
- data/deep_cloneable.gemspec +3 -3
- data/gemfiles/3.1.gemfile +1 -0
- data/gemfiles/3.1.gemfile.lock +6 -5
- data/gemfiles/3.2.gemfile +1 -0
- data/gemfiles/3.2.gemfile.lock +12 -11
- data/gemfiles/4.0.gemfile +1 -0
- data/gemfiles/4.0.gemfile.lock +8 -7
- data/gemfiles/4.1.gemfile +1 -0
- data/gemfiles/4.1.gemfile.lock +13 -12
- data/gemfiles/4.2.gemfile +1 -0
- data/gemfiles/4.2.gemfile.lock +13 -12
- data/gemfiles/5.0.gemfile +2 -1
- data/gemfiles/5.0.gemfile.lock +15 -14
- data/lib/deep_cloneable.rb +17 -7
- data/readme.md +12 -1
- data/test/models.rb +12 -1
- data/test/schema.rb +5 -0
- data/test/test_deep_cloneable.rb +27 -0
- data/test/test_helper.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6f91e67baa2dd1118f4ab807655791d72e9f69e
|
4
|
+
data.tar.gz: 3cd1a98dd2828ab747e267f8f749b8fc41b4cc79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a23f55f760ec9de1b06fc1f2fe09f4fa28224c0a545e3607b185129c8625e7344a6e3c5de5e400bc2caedf5b39ccaa890a5e5fcddda5cceea47b2b88fad4910
|
7
|
+
data.tar.gz: 490a16bde06aaa25654aa0264214f5b7474d7233c7681da4acaef0073a45fd1ecbe14814fb1cbbd219b2647b5d4c914f3dee919d33c361dc0cfcb2eeb0a7ace1
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/Gemfile
CHANGED
@@ -5,6 +5,7 @@ gem 'activerecord', '>= 3.1.0', '< 5.2.0'
|
|
5
5
|
gem 'i18n', '~> 0.6.5', :group => :test
|
6
6
|
gem 'highline', '~> 1.6.0', :group => :test
|
7
7
|
gem 'rake', '~> 10.4', :group => :test
|
8
|
+
gem 'rack', '~> 1.6', :group => :test
|
8
9
|
gem 'git', '~> 1.2.9', :group => :test
|
9
10
|
|
10
11
|
gem 'minitest', :group => :test
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.2
|
data/deep_cloneable.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: deep_cloneable 2.2.
|
5
|
+
# stub: deep_cloneable 2.2.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "deep_cloneable".freeze
|
9
|
-
s.version = "2.2.
|
9
|
+
s.version = "2.2.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Reinier de Lange".freeze]
|
14
|
-
s.date = "2016-
|
14
|
+
s.date = "2016-10-10"
|
15
15
|
s.description = "Extends the functionality of ActiveRecord::Base#dup to perform a deep clone that includes user specified associations. ".freeze
|
16
16
|
s.email = "r.j.delange@nedforce.nl".freeze
|
17
17
|
s.extra_rdoc_files = [
|
data/gemfiles/3.1.gemfile
CHANGED
@@ -6,6 +6,7 @@ gem "activerecord", "~> 3.1.0"
|
|
6
6
|
gem "i18n", "~> 0.6.5", :group => :test
|
7
7
|
gem "highline", "~> 1.6.0", :group => :test
|
8
8
|
gem "rake", "~> 10.4", :group => :test
|
9
|
+
gem "rack", "~> 1.6", :group => :test
|
9
10
|
gem "git", "~> 1.2.9", :group => :test
|
10
11
|
gem "minitest", :group => :test
|
11
12
|
gem "appraisal", :group => :test
|
data/gemfiles/3.1.gemfile.lock
CHANGED
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
multi_json (~> 1.4)
|
30
30
|
nokogiri (~> 1.5.2)
|
31
31
|
oauth2
|
32
|
-
hashie (3.4.
|
32
|
+
hashie (3.4.6)
|
33
33
|
highline (1.6.21)
|
34
34
|
i18n (0.6.11)
|
35
35
|
jeweler (2.1.1)
|
@@ -43,15 +43,15 @@ GEM
|
|
43
43
|
rdoc
|
44
44
|
semver
|
45
45
|
json (1.8.3)
|
46
|
-
jwt (1.5.
|
46
|
+
jwt (1.5.4)
|
47
47
|
minitest (5.9.0)
|
48
48
|
multi_json (1.12.1)
|
49
49
|
multi_xml (0.5.5)
|
50
50
|
multipart-post (1.2.0)
|
51
51
|
nokogiri (1.5.11)
|
52
|
-
oauth2 (1.
|
52
|
+
oauth2 (1.2.0)
|
53
53
|
faraday (>= 0.8, < 0.10)
|
54
|
-
jwt (~> 1.0
|
54
|
+
jwt (~> 1.0)
|
55
55
|
multi_json (~> 1.3)
|
56
56
|
multi_xml (~> 0.5)
|
57
57
|
rack (>= 1.2, < 3)
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
semver (1.0.1)
|
63
63
|
sqlite3 (1.3.11)
|
64
64
|
thor (0.19.1)
|
65
|
-
tzinfo (0.3.
|
65
|
+
tzinfo (0.3.51)
|
66
66
|
|
67
67
|
PLATFORMS
|
68
68
|
ruby
|
@@ -77,6 +77,7 @@ DEPENDENCIES
|
|
77
77
|
jeweler
|
78
78
|
minitest
|
79
79
|
nokogiri (~> 1.5.0)
|
80
|
+
rack (~> 1.6)
|
80
81
|
rake (~> 10.4)
|
81
82
|
rdoc (>= 2.4.2)
|
82
83
|
sqlite3
|
data/gemfiles/3.2.gemfile
CHANGED
@@ -6,6 +6,7 @@ gem "activerecord", "~> 3.2.0"
|
|
6
6
|
gem "i18n", "~> 0.6.5", :group => :test
|
7
7
|
gem "highline", "~> 1.6.0", :group => :test
|
8
8
|
gem "rake", "~> 10.4", :group => :test
|
9
|
+
gem "rack", "~> 1.6", :group => :test
|
9
10
|
gem "git", "~> 1.2.9", :group => :test
|
10
11
|
gem "minitest", :group => :test
|
11
12
|
gem "appraisal", :group => :test
|
data/gemfiles/3.2.gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.2.22.
|
5
|
-
activesupport (= 3.2.22.
|
4
|
+
activemodel (3.2.22.5)
|
5
|
+
activesupport (= 3.2.22.5)
|
6
6
|
builder (~> 3.0.0)
|
7
|
-
activerecord (3.2.22.
|
8
|
-
activemodel (= 3.2.22.
|
9
|
-
activesupport (= 3.2.22.
|
7
|
+
activerecord (3.2.22.5)
|
8
|
+
activemodel (= 3.2.22.5)
|
9
|
+
activesupport (= 3.2.22.5)
|
10
10
|
arel (~> 3.0.2)
|
11
11
|
tzinfo (~> 0.3.29)
|
12
|
-
activesupport (3.2.22.
|
12
|
+
activesupport (3.2.22.5)
|
13
13
|
i18n (~> 0.6, >= 0.6.4)
|
14
14
|
multi_json (~> 1.0)
|
15
15
|
addressable (2.3.8)
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
multi_json (~> 1.4)
|
30
30
|
nokogiri (~> 1.5.2)
|
31
31
|
oauth2
|
32
|
-
hashie (3.4.
|
32
|
+
hashie (3.4.6)
|
33
33
|
highline (1.6.21)
|
34
34
|
i18n (0.6.11)
|
35
35
|
jeweler (2.1.1)
|
@@ -43,15 +43,15 @@ GEM
|
|
43
43
|
rdoc
|
44
44
|
semver
|
45
45
|
json (1.8.3)
|
46
|
-
jwt (1.5.
|
46
|
+
jwt (1.5.4)
|
47
47
|
minitest (5.9.0)
|
48
48
|
multi_json (1.12.1)
|
49
49
|
multi_xml (0.5.5)
|
50
50
|
multipart-post (1.2.0)
|
51
51
|
nokogiri (1.5.11)
|
52
|
-
oauth2 (1.
|
52
|
+
oauth2 (1.2.0)
|
53
53
|
faraday (>= 0.8, < 0.10)
|
54
|
-
jwt (~> 1.0
|
54
|
+
jwt (~> 1.0)
|
55
55
|
multi_json (~> 1.3)
|
56
56
|
multi_xml (~> 0.5)
|
57
57
|
rack (>= 1.2, < 3)
|
@@ -62,7 +62,7 @@ GEM
|
|
62
62
|
semver (1.0.1)
|
63
63
|
sqlite3 (1.3.11)
|
64
64
|
thor (0.19.1)
|
65
|
-
tzinfo (0.3.
|
65
|
+
tzinfo (0.3.51)
|
66
66
|
|
67
67
|
PLATFORMS
|
68
68
|
ruby
|
@@ -77,6 +77,7 @@ DEPENDENCIES
|
|
77
77
|
jeweler
|
78
78
|
minitest
|
79
79
|
nokogiri (~> 1.5.0)
|
80
|
+
rack (~> 1.6)
|
80
81
|
rake (~> 10.4)
|
81
82
|
rdoc (>= 2.4.2)
|
82
83
|
sqlite3
|
data/gemfiles/4.0.gemfile
CHANGED
@@ -6,6 +6,7 @@ gem "activerecord", "~> 4.0.0"
|
|
6
6
|
gem "i18n", "~> 0.6.5", :group => :test
|
7
7
|
gem "highline", "~> 1.6.0", :group => :test
|
8
8
|
gem "rake", "~> 10.4", :group => :test
|
9
|
+
gem "rack", "~> 1.6", :group => :test
|
9
10
|
gem "git", "~> 1.2.9", :group => :test
|
10
11
|
gem "minitest", :group => :test
|
11
12
|
gem "appraisal", :group => :test
|
data/gemfiles/4.0.gemfile.lock
CHANGED
@@ -28,13 +28,13 @@ GEM
|
|
28
28
|
faraday (0.9.2)
|
29
29
|
multipart-post (>= 1.2, < 3)
|
30
30
|
git (1.2.9.1)
|
31
|
-
github_api (0.14.
|
31
|
+
github_api (0.14.5)
|
32
32
|
addressable (~> 2.4.0)
|
33
33
|
descendants_tracker (~> 0.0.4)
|
34
34
|
faraday (~> 0.8, < 0.10)
|
35
35
|
hashie (>= 3.4)
|
36
|
-
oauth2
|
37
|
-
hashie (3.4.
|
36
|
+
oauth2 (~> 1.0)
|
37
|
+
hashie (3.4.6)
|
38
38
|
highline (1.6.21)
|
39
39
|
i18n (0.6.11)
|
40
40
|
jeweler (2.1.1)
|
@@ -48,15 +48,15 @@ GEM
|
|
48
48
|
rdoc
|
49
49
|
semver
|
50
50
|
json (1.8.3)
|
51
|
-
jwt (1.5.
|
51
|
+
jwt (1.5.4)
|
52
52
|
minitest (4.7.5)
|
53
53
|
multi_json (1.12.1)
|
54
54
|
multi_xml (0.5.5)
|
55
55
|
multipart-post (2.0.0)
|
56
56
|
nokogiri (1.5.11)
|
57
|
-
oauth2 (1.
|
57
|
+
oauth2 (1.2.0)
|
58
58
|
faraday (>= 0.8, < 0.10)
|
59
|
-
jwt (~> 1.0
|
59
|
+
jwt (~> 1.0)
|
60
60
|
multi_json (~> 1.3)
|
61
61
|
multi_xml (~> 0.5)
|
62
62
|
rack (>= 1.2, < 3)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
sqlite3 (1.3.11)
|
69
69
|
thor (0.19.1)
|
70
70
|
thread_safe (0.3.5)
|
71
|
-
tzinfo (0.3.
|
71
|
+
tzinfo (0.3.51)
|
72
72
|
|
73
73
|
PLATFORMS
|
74
74
|
ruby
|
@@ -82,6 +82,7 @@ DEPENDENCIES
|
|
82
82
|
jeweler
|
83
83
|
minitest
|
84
84
|
nokogiri (~> 1.5.0)
|
85
|
+
rack (~> 1.6)
|
85
86
|
rake (~> 10.4)
|
86
87
|
rdoc (>= 2.4.2)
|
87
88
|
sqlite3
|
data/gemfiles/4.1.gemfile
CHANGED
@@ -6,6 +6,7 @@ gem "activerecord", "~> 4.1.0"
|
|
6
6
|
gem "i18n", "~> 0.6.5", :group => :test
|
7
7
|
gem "highline", "~> 1.6.0", :group => :test
|
8
8
|
gem "rake", "~> 10.4", :group => :test
|
9
|
+
gem "rack", "~> 1.6", :group => :test
|
9
10
|
gem "git", "~> 1.2.9", :group => :test
|
10
11
|
gem "minitest", :group => :test
|
11
12
|
gem "appraisal", :group => :test
|
data/gemfiles/4.1.gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (4.1.
|
5
|
-
activesupport (= 4.1.
|
4
|
+
activemodel (4.1.16)
|
5
|
+
activesupport (= 4.1.16)
|
6
6
|
builder (~> 3.1)
|
7
|
-
activerecord (4.1.
|
8
|
-
activemodel (= 4.1.
|
9
|
-
activesupport (= 4.1.
|
7
|
+
activerecord (4.1.16)
|
8
|
+
activemodel (= 4.1.16)
|
9
|
+
activesupport (= 4.1.16)
|
10
10
|
arel (~> 5.0.0)
|
11
|
-
activesupport (4.1.
|
11
|
+
activesupport (4.1.16)
|
12
12
|
i18n (~> 0.6, >= 0.6.9)
|
13
13
|
json (~> 1.7, >= 1.7.7)
|
14
14
|
minitest (~> 5.1)
|
@@ -26,13 +26,13 @@ GEM
|
|
26
26
|
faraday (0.9.2)
|
27
27
|
multipart-post (>= 1.2, < 3)
|
28
28
|
git (1.2.9.1)
|
29
|
-
github_api (0.14.
|
29
|
+
github_api (0.14.5)
|
30
30
|
addressable (~> 2.4.0)
|
31
31
|
descendants_tracker (~> 0.0.4)
|
32
32
|
faraday (~> 0.8, < 0.10)
|
33
33
|
hashie (>= 3.4)
|
34
|
-
oauth2
|
35
|
-
hashie (3.4.
|
34
|
+
oauth2 (~> 1.0)
|
35
|
+
hashie (3.4.6)
|
36
36
|
highline (1.6.21)
|
37
37
|
i18n (0.6.11)
|
38
38
|
jeweler (2.1.1)
|
@@ -46,15 +46,15 @@ GEM
|
|
46
46
|
rdoc
|
47
47
|
semver
|
48
48
|
json (1.8.3)
|
49
|
-
jwt (1.5.
|
49
|
+
jwt (1.5.4)
|
50
50
|
minitest (5.9.0)
|
51
51
|
multi_json (1.12.1)
|
52
52
|
multi_xml (0.5.5)
|
53
53
|
multipart-post (2.0.0)
|
54
54
|
nokogiri (1.5.11)
|
55
|
-
oauth2 (1.
|
55
|
+
oauth2 (1.2.0)
|
56
56
|
faraday (>= 0.8, < 0.10)
|
57
|
-
jwt (~> 1.0
|
57
|
+
jwt (~> 1.0)
|
58
58
|
multi_json (~> 1.3)
|
59
59
|
multi_xml (~> 0.5)
|
60
60
|
rack (>= 1.2, < 3)
|
@@ -81,6 +81,7 @@ DEPENDENCIES
|
|
81
81
|
jeweler
|
82
82
|
minitest
|
83
83
|
nokogiri (~> 1.5.0)
|
84
|
+
rack (~> 1.6)
|
84
85
|
rake (~> 10.4)
|
85
86
|
rdoc (>= 2.4.2)
|
86
87
|
sqlite3
|
data/gemfiles/4.2.gemfile
CHANGED
@@ -6,6 +6,7 @@ gem "activerecord", "~> 4.2.3"
|
|
6
6
|
gem "i18n", "~> 0.7.0"
|
7
7
|
gem "highline", "~> 1.6.0", :group => :test
|
8
8
|
gem "rake", "~> 10.4", :group => :test
|
9
|
+
gem "rack", "~> 1.6", :group => :test
|
9
10
|
gem "git", "~> 1.2.9", :group => :test
|
10
11
|
gem "minitest", :group => :test
|
11
12
|
gem "appraisal", :group => :test
|
data/gemfiles/4.2.gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (4.2.
|
5
|
-
activesupport (= 4.2.
|
4
|
+
activemodel (4.2.7.1)
|
5
|
+
activesupport (= 4.2.7.1)
|
6
6
|
builder (~> 3.1)
|
7
|
-
activerecord (4.2.
|
8
|
-
activemodel (= 4.2.
|
9
|
-
activesupport (= 4.2.
|
7
|
+
activerecord (4.2.7.1)
|
8
|
+
activemodel (= 4.2.7.1)
|
9
|
+
activesupport (= 4.2.7.1)
|
10
10
|
arel (~> 6.0)
|
11
|
-
activesupport (4.2.
|
11
|
+
activesupport (4.2.7.1)
|
12
12
|
i18n (~> 0.7)
|
13
13
|
json (~> 1.7, >= 1.7.7)
|
14
14
|
minitest (~> 5.1)
|
@@ -26,13 +26,13 @@ GEM
|
|
26
26
|
faraday (0.9.2)
|
27
27
|
multipart-post (>= 1.2, < 3)
|
28
28
|
git (1.2.9.1)
|
29
|
-
github_api (0.14.
|
29
|
+
github_api (0.14.5)
|
30
30
|
addressable (~> 2.4.0)
|
31
31
|
descendants_tracker (~> 0.0.4)
|
32
32
|
faraday (~> 0.8, < 0.10)
|
33
33
|
hashie (>= 3.4)
|
34
|
-
oauth2
|
35
|
-
hashie (3.4.
|
34
|
+
oauth2 (~> 1.0)
|
35
|
+
hashie (3.4.6)
|
36
36
|
highline (1.6.21)
|
37
37
|
i18n (0.7.0)
|
38
38
|
jeweler (2.1.1)
|
@@ -46,15 +46,15 @@ GEM
|
|
46
46
|
rdoc
|
47
47
|
semver
|
48
48
|
json (1.8.3)
|
49
|
-
jwt (1.5.
|
49
|
+
jwt (1.5.4)
|
50
50
|
minitest (5.9.0)
|
51
51
|
multi_json (1.12.1)
|
52
52
|
multi_xml (0.5.5)
|
53
53
|
multipart-post (2.0.0)
|
54
54
|
nokogiri (1.5.11)
|
55
|
-
oauth2 (1.
|
55
|
+
oauth2 (1.2.0)
|
56
56
|
faraday (>= 0.8, < 0.10)
|
57
|
-
jwt (~> 1.0
|
57
|
+
jwt (~> 1.0)
|
58
58
|
multi_json (~> 1.3)
|
59
59
|
multi_xml (~> 0.5)
|
60
60
|
rack (>= 1.2, < 3)
|
@@ -81,6 +81,7 @@ DEPENDENCIES
|
|
81
81
|
jeweler
|
82
82
|
minitest
|
83
83
|
nokogiri (~> 1.5.0)
|
84
|
+
rack (~> 1.6)
|
84
85
|
rake (~> 10.4)
|
85
86
|
rdoc (>= 2.4.2)
|
86
87
|
sqlite3
|
data/gemfiles/5.0.gemfile
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
|
-
gem "activerecord", "~> 5.0.0
|
5
|
+
gem "activerecord", "~> 5.0.0"
|
6
6
|
gem "i18n", "~> 0.7.0"
|
7
7
|
gem "highline", "~> 1.6.0", :group => :test
|
8
8
|
gem "rake", "~> 10.4", :group => :test
|
9
|
+
gem "rack", "~> 1.6", :group => :test
|
9
10
|
gem "git", "~> 1.2.9", :group => :test
|
10
11
|
gem "minitest", :group => :test
|
11
12
|
gem "appraisal", :group => :test
|
data/gemfiles/5.0.gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (5.0.0.
|
5
|
-
activesupport (= 5.0.0.
|
6
|
-
activerecord (5.0.0.
|
7
|
-
activemodel (= 5.0.0.
|
8
|
-
activesupport (= 5.0.0.
|
4
|
+
activemodel (5.0.0.1)
|
5
|
+
activesupport (= 5.0.0.1)
|
6
|
+
activerecord (5.0.0.1)
|
7
|
+
activemodel (= 5.0.0.1)
|
8
|
+
activesupport (= 5.0.0.1)
|
9
9
|
arel (~> 7.0)
|
10
|
-
activesupport (5.0.0.
|
10
|
+
activesupport (5.0.0.1)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (~> 0.7)
|
13
13
|
minitest (~> 5.1)
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
bundler
|
18
18
|
rake
|
19
19
|
thor (>= 0.14.0)
|
20
|
-
arel (7.
|
20
|
+
arel (7.1.1)
|
21
21
|
builder (3.2.2)
|
22
22
|
concurrent-ruby (1.0.2)
|
23
23
|
descendants_tracker (0.0.4)
|
@@ -25,13 +25,13 @@ GEM
|
|
25
25
|
faraday (0.9.2)
|
26
26
|
multipart-post (>= 1.2, < 3)
|
27
27
|
git (1.2.9.1)
|
28
|
-
github_api (0.14.
|
28
|
+
github_api (0.14.5)
|
29
29
|
addressable (~> 2.4.0)
|
30
30
|
descendants_tracker (~> 0.0.4)
|
31
31
|
faraday (~> 0.8, < 0.10)
|
32
32
|
hashie (>= 3.4)
|
33
|
-
oauth2
|
34
|
-
hashie (3.4.
|
33
|
+
oauth2 (~> 1.0)
|
34
|
+
hashie (3.4.6)
|
35
35
|
highline (1.6.21)
|
36
36
|
i18n (0.7.0)
|
37
37
|
jeweler (2.1.1)
|
@@ -45,15 +45,15 @@ GEM
|
|
45
45
|
rdoc
|
46
46
|
semver
|
47
47
|
json (1.8.3)
|
48
|
-
jwt (1.5.
|
48
|
+
jwt (1.5.4)
|
49
49
|
minitest (5.9.0)
|
50
50
|
multi_json (1.12.1)
|
51
51
|
multi_xml (0.5.5)
|
52
52
|
multipart-post (2.0.0)
|
53
53
|
nokogiri (1.5.11)
|
54
|
-
oauth2 (1.
|
54
|
+
oauth2 (1.2.0)
|
55
55
|
faraday (>= 0.8, < 0.10)
|
56
|
-
jwt (~> 1.0
|
56
|
+
jwt (~> 1.0)
|
57
57
|
multi_json (~> 1.3)
|
58
58
|
multi_xml (~> 0.5)
|
59
59
|
rack (>= 1.2, < 3)
|
@@ -72,7 +72,7 @@ PLATFORMS
|
|
72
72
|
ruby
|
73
73
|
|
74
74
|
DEPENDENCIES
|
75
|
-
activerecord (~> 5.0.0
|
75
|
+
activerecord (~> 5.0.0)
|
76
76
|
appraisal
|
77
77
|
git (~> 1.2.9)
|
78
78
|
highline (~> 1.6.0)
|
@@ -80,6 +80,7 @@ DEPENDENCIES
|
|
80
80
|
jeweler
|
81
81
|
minitest
|
82
82
|
nokogiri (~> 1.5.0)
|
83
|
+
rack (~> 1.6)
|
83
84
|
rake (~> 10.4)
|
84
85
|
rdoc (>= 2.4.2)
|
85
86
|
sqlite3
|
data/lib/deep_cloneable.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_record"
|
2
|
+
|
1
3
|
class ActiveRecord::Base
|
2
4
|
module DeepCloneable
|
3
5
|
|
@@ -98,7 +100,7 @@ class ActiveRecord::Base
|
|
98
100
|
private
|
99
101
|
|
100
102
|
def dup_default_attribute_value_to(kopy, attribute, origin)
|
101
|
-
kopy
|
103
|
+
kopy[attribute] = origin.class.column_defaults.dup[attribute.to_s]
|
102
104
|
end
|
103
105
|
|
104
106
|
def dup_belongs_to_association options, &block
|
@@ -114,9 +116,13 @@ class ActiveRecord::Base
|
|
114
116
|
def dup_has_many_association options, &block
|
115
117
|
primary_key_name = options[:reflection].foreign_key.to_s
|
116
118
|
|
117
|
-
|
118
|
-
|
119
|
-
|
119
|
+
if options[:reflection].inverse_of.present?
|
120
|
+
reverse_association_name = options[:reflection].inverse_of.name
|
121
|
+
else
|
122
|
+
reverse_association_name = options[:reflection].klass.reflect_on_all_associations.detect do |reflection|
|
123
|
+
reflection.foreign_key.to_s == primary_key_name && reflection != options[:reflection]
|
124
|
+
end.try(:name)
|
125
|
+
end
|
120
126
|
|
121
127
|
objects = self.send(options[:association])
|
122
128
|
objects = objects.select{|object| evaluate_conditions(object, options[:conditions]) } if options[:conditions].any?
|
@@ -142,9 +148,13 @@ class ActiveRecord::Base
|
|
142
148
|
end
|
143
149
|
|
144
150
|
def dup_join_association options, &block
|
145
|
-
|
146
|
-
|
147
|
-
|
151
|
+
if options[:reflection].inverse_of.present?
|
152
|
+
reverse_association_name = options[:reflection].inverse_of.name
|
153
|
+
else
|
154
|
+
reverse_association_name = options[:reflection].klass.reflect_on_all_associations.detect do |reflection|
|
155
|
+
(reflection.macro == options[:macro]) && (reflection.association_foreign_key.to_s == options[:primary_key_name])
|
156
|
+
end.try(:name)
|
157
|
+
end
|
148
158
|
|
149
159
|
objects = self.send(options[:association])
|
150
160
|
objects = objects.select{|object| evaluate_conditions(object, options[:conditions]) } if options[:conditions].any?
|
data/readme.md
CHANGED
@@ -15,7 +15,7 @@ This gem gives every ActiveRecord::Base object the possibility to do a deep clon
|
|
15
15
|
* Add deep_cloneable to your Gemfile:
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem 'deep_cloneable', '~> 2.2.
|
18
|
+
gem 'deep_cloneable', '~> 2.2.2'
|
19
19
|
```
|
20
20
|
|
21
21
|
## Upgrading from v1
|
@@ -112,6 +112,17 @@ end
|
|
112
112
|
|
113
113
|
*Note*: Using `deep_clone` with a block will also pass the associated objects that are being cloned to the block, so be sure to check whether the object actually responds to your method of choice.
|
114
114
|
|
115
|
+
### Cloning models with files associated through Carrierwave
|
116
|
+
|
117
|
+
If you are cloning models that have associated files through Carrierwave these will not get transferred automatically. To overcome the issue you need to explicitly set the file attribute.
|
118
|
+
|
119
|
+
Easiest solution is to add the code in a clone block as described above.
|
120
|
+
```ruby
|
121
|
+
pirate.deep_clone include: :parrot do |original, kopy|
|
122
|
+
kopy.thumbnail = original.thumbnail
|
123
|
+
end
|
124
|
+
```
|
125
|
+
|
115
126
|
### Note on Patches/Pull Requests
|
116
127
|
|
117
128
|
* Fork the project.
|
data/test/models.rb
CHANGED
@@ -25,9 +25,19 @@ end
|
|
25
25
|
|
26
26
|
class GoldPiece < ActiveRecord::Base; belongs_to :treasure end
|
27
27
|
class Matey < ActiveRecord::Base; belongs_to :pirate end
|
28
|
-
class Parrot < ActiveRecord::Base; belongs_to :pirate; attr_accessor :cloned_from_id end
|
29
28
|
class BattleShip < ActiveRecord::Base; has_many :pirates, :as => :ship end
|
30
29
|
|
30
|
+
class Parrot < ActiveRecord::Base
|
31
|
+
belongs_to :pirate
|
32
|
+
has_many :parrot_cages, :foreign_key => :owner_id, :inverse_of => :parrot, :class_name => 'Cage'
|
33
|
+
attr_accessor :cloned_from_id
|
34
|
+
end
|
35
|
+
|
36
|
+
class Cage < ActiveRecord::Base
|
37
|
+
belongs_to :parrot, :foreign_key => :owner_id, :inverse_of => :parrot_cages
|
38
|
+
belongs_to :pirate, :foreign_key => :owner_id, :inverse_of => :pirate_cages
|
39
|
+
end
|
40
|
+
|
31
41
|
class Pirate < ActiveRecord::Base
|
32
42
|
belongs_to :ship, :polymorphic => true
|
33
43
|
|
@@ -35,6 +45,7 @@ class Pirate < ActiveRecord::Base
|
|
35
45
|
has_many :treasures, :foreign_key => 'owner'
|
36
46
|
has_many :gold_pieces, :through => :treasures
|
37
47
|
has_one :parrot
|
48
|
+
has_many :pirate_cages, :inverse_of => :pirate, :foreign_key => :owner_id, :class_name => 'Cage'
|
38
49
|
|
39
50
|
serialize :piastres
|
40
51
|
|
data/test/schema.rb
CHANGED
@@ -25,6 +25,11 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
25
25
|
t.column :matey_id, :integer
|
26
26
|
end
|
27
27
|
|
28
|
+
create_table :cages, :force => true do |t|
|
29
|
+
t.column :name, :string
|
30
|
+
t.column :owner_id, :integer
|
31
|
+
end
|
32
|
+
|
28
33
|
create_table :gold_pieces, :force => true do |t|
|
29
34
|
t.column :treasure_id, :integer
|
30
35
|
end
|
data/test/test_deep_cloneable.rb
CHANGED
@@ -100,6 +100,15 @@ class TestDeepCloneable < MiniTest::Unit::TestCase
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
def test_include_association_assignments_with_inverse_of
|
104
|
+
@jack.pirate_cages.build
|
105
|
+
deep_clone = @jack.deep_clone(:include => :pirate_cages)
|
106
|
+
assert deep_clone.new_record?
|
107
|
+
deep_clone.pirate_cages.each do |cage|
|
108
|
+
assert_equal deep_clone, cage.pirate
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
103
112
|
def test_multiple_and_deep_include_association
|
104
113
|
deep_clone = @jack.deep_clone(:include => {:treasures => :gold_pieces, :mateys => {}})
|
105
114
|
assert deep_clone.new_record?
|
@@ -363,6 +372,18 @@ class TestDeepCloneable < MiniTest::Unit::TestCase
|
|
363
372
|
assert_equal 0, deep_clone.mateys.size
|
364
373
|
end
|
365
374
|
|
375
|
+
def test_should_properly_read_conditions_in_arrays
|
376
|
+
subject1 = Subject.create(:name => 'subject 1')
|
377
|
+
subject2 = Subject.create(:name => 'subject 2')
|
378
|
+
student = Student.create(:name => 'Parent', :subjects => [subject1, subject2])
|
379
|
+
|
380
|
+
deep_clone = student.deep_clone(:include => [:subjects => [:if => lambda{|subject| false }] ])
|
381
|
+
assert deep_clone.subjects.none?
|
382
|
+
|
383
|
+
deep_clone = student.deep_clone(:include => [:subjects => [:if => lambda{|subject| true }] ])
|
384
|
+
assert_equal 2, deep_clone.subjects.size
|
385
|
+
end
|
386
|
+
|
366
387
|
def test_should_reject_copies_if_conditionals_are_passed_with_associations
|
367
388
|
deep_clone = @ship.deep_clone(:include => [:pirates => [:treasures, :mateys, { :unless => lambda {|pirate| pirate.name == 'Jack Sparrow'} }]])
|
368
389
|
|
@@ -400,4 +421,10 @@ class TestDeepCloneable < MiniTest::Unit::TestCase
|
|
400
421
|
assert_equal deep_clone.contractors.first.apartments.first.id, deep_clone.apartments.first.id
|
401
422
|
assert_equal deep_clone.apartments.first.contractors.first.id, deep_clone.contractors.first.id
|
402
423
|
end
|
424
|
+
|
425
|
+
def test_should_not_make_attributes_dirty_for_exceptions
|
426
|
+
deep_clone = @jack.deep_clone(:except => :name)
|
427
|
+
assert_nil deep_clone.name
|
428
|
+
refute deep_clone.name_changed?
|
429
|
+
end
|
403
430
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deep_cloneable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reinier de Lange
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|