soft_deletion 0.4.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -3
- data/Appraisals +1 -2
- data/Gemfile.lock +1 -1
- data/gemfiles/rails4.gemfile +2 -2
- data/lib/soft_deletion/setup.rb +10 -4
- data/lib/soft_deletion/version.rb +1 -1
- metadata +4 -4
data/.travis.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
rvm:
|
2
2
|
- 1.9.3
|
3
|
-
-
|
3
|
+
- ree
|
4
4
|
- 2.0
|
5
5
|
gemfile:
|
6
6
|
- gemfiles/rails2.gemfile
|
@@ -12,6 +12,6 @@ matrix:
|
|
12
12
|
gemfile: gemfiles/rails2.gemfile
|
13
13
|
- rvm: 2.0
|
14
14
|
gemfile: gemfiles/rails30.gemfile
|
15
|
-
- rvm:
|
15
|
+
- rvm: ree
|
16
16
|
gemfile: gemfiles/rails4.gemfile
|
17
|
-
script: "rake spec"
|
17
|
+
script: "bundle exec rake spec"
|
data/Appraisals
CHANGED
data/Gemfile.lock
CHANGED
data/gemfiles/rails4.gemfile
CHANGED
data/lib/soft_deletion/setup.rb
CHANGED
@@ -21,12 +21,18 @@ module SoftDeletion
|
|
21
21
|
|
22
22
|
options = default_options.merge(options)
|
23
23
|
|
24
|
-
if options[:default_scope]
|
25
|
-
# Avoids a bad SQL request with versions of code without the column deleted_at (for example a migration prior to the migration
|
26
|
-
# that adds deleted_at)
|
24
|
+
if options[:default_scope]
|
27
25
|
conditions = {:deleted_at => nil}
|
28
26
|
if ActiveRecord::VERSION::STRING < "3.1"
|
29
|
-
|
27
|
+
# Avoids a bad SQL request with versions of code without the column deleted_at
|
28
|
+
# (for example a migration prior to the migration that adds deleted_at)
|
29
|
+
if !table_exists?
|
30
|
+
warn "#{table_name} table missing, disabling soft_deletion default scope"
|
31
|
+
elsif !column_names.include?("deleted_at")
|
32
|
+
warn "#{table_name} does not have deleted_at column, disabling soft_deletion default scope"
|
33
|
+
else
|
34
|
+
default_scope :conditions => conditions
|
35
|
+
end
|
30
36
|
else
|
31
37
|
default_scope { where(conditions) }
|
32
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soft_deletion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: michael@grosser.it
|
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
54
|
version: '0'
|
55
55
|
segments:
|
56
56
|
- 0
|
57
|
-
hash:
|
57
|
+
hash: 1457355893249503490
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
59
|
none: false
|
60
60
|
requirements:
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash:
|
66
|
+
hash: 1457355893249503490
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
69
|
rubygems_version: 1.8.25
|