destroyed_at 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/destroyed_at.gemspec +1 -1
- data/lib/destroyed_at.rb +1 -2
- data/lib/destroyed_at/version.rb +1 -1
- data/test/destroyed_at_test.rb +13 -0
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d06484805624dd702d8643850b8f78b685c98af
|
4
|
+
data.tar.gz: d0d99bfb2bcabbf43ba9b862ee70feeef8a25397
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e0fff0a4085b7a3ee28b2fec68eb9899b91689933fa1abf1e3deb780eac1b7d1d3259041033879f65bc580d8c99cc5ce736f3242aacf0359133354ec044d2f0
|
7
|
+
data.tar.gz: 4e13c5e59e4a735df53c146a1c60c35852b74f2f2164e9ae2d8ed6ccb282b9066d26a69a62540c84b8cbc3b378fbfa1fbd6b0d00637e88644bd57fa299aaa265
|
data/destroyed_at.gemspec
CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "sqlite3"
|
26
26
|
spec.add_development_dependency "byebug"
|
27
27
|
spec.add_development_dependency "timecop"
|
28
|
-
spec.add_development_dependency "database_cleaner"
|
28
|
+
spec.add_development_dependency "database_cleaner", '1.0.1'
|
29
29
|
end
|
data/lib/destroyed_at.rb
CHANGED
@@ -44,8 +44,7 @@ module DestroyedAt
|
|
44
44
|
if assoc.options[:through] && assoc.options[:dependent] == :destroy
|
45
45
|
assoc = association(assoc.options[:through])
|
46
46
|
end
|
47
|
-
|
48
|
-
relation.unscoped.each { |r| r.restore if r.respond_to? :restore }
|
47
|
+
assoc.association_scope.each { |r| r.restore if r.respond_to? :restore }
|
49
48
|
end
|
50
49
|
end
|
51
50
|
end
|
data/lib/destroyed_at/version.rb
CHANGED
data/test/destroyed_at_test.rb
CHANGED
@@ -103,4 +103,17 @@ describe 'Destroying AR models' do
|
|
103
103
|
User.create
|
104
104
|
User.select(:id).must_be_kind_of ActiveRecord::Relation
|
105
105
|
end
|
106
|
+
|
107
|
+
it 'only destroys and restores related dependents' do
|
108
|
+
2.times do
|
109
|
+
User.create(dinners: [Dinner.create, Dinner.create, Dinner.create])
|
110
|
+
end
|
111
|
+
|
112
|
+
User.first.destroy
|
113
|
+
Dinner.count.must_equal 3
|
114
|
+
User.first.destroy
|
115
|
+
Dinner.count.must_equal 0
|
116
|
+
User.unscoped.first.restore
|
117
|
+
Dinner.count.must_equal 3
|
118
|
+
end
|
106
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: destroyed_at
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dupuis Jr.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: database_cleaner
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - '
|
129
|
+
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.0.1
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - '
|
136
|
+
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 1.0.1
|
139
139
|
description: Safe destroy for ActiveRecord.
|
140
140
|
email:
|
141
141
|
- michael.dupuis@dockyard.com
|
@@ -174,11 +174,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
176
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.1.0
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Safe destroy for ActiveRecord.
|
181
181
|
test_files:
|
182
182
|
- test/destroyed_at_test.rb
|
183
183
|
- test/test_helper.rb
|
184
|
-
has_rdoc:
|