soft_deletion 0.4.6 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  rvm:
2
2
  - 1.9.3
3
- - 1.8.7
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: 1.8.7
15
+ - rvm: ree
16
16
  gemfile: gemfiles/rails4.gemfile
17
- script: "rake spec"
17
+ script: "bundle exec rake spec"
data/Appraisals CHANGED
@@ -17,8 +17,7 @@ appraise "rails32" do
17
17
  end
18
18
 
19
19
  appraise "rails4" do
20
- version = "4.0.0.beta1"
20
+ version = "4.0.0"
21
21
  gem 'activerecord', version
22
22
  gem 'activesupport', version
23
23
  end
24
-
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- soft_deletion (0.4.6)
4
+ soft_deletion (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -8,7 +8,7 @@ gem "sqlite3"
8
8
  gem "rspec"
9
9
  gem "database_cleaner", "1.0.0.RC1"
10
10
  gem "bump"
11
- gem "activerecord", "4.0.0.beta1"
12
- gem "activesupport", "4.0.0.beta1"
11
+ gem "activerecord", "4.0.0"
12
+ gem "activesupport", "4.0.0"
13
13
 
14
14
  gemspec :path=>"../"
@@ -21,12 +21,18 @@ module SoftDeletion
21
21
 
22
22
  options = default_options.merge(options)
23
23
 
24
- if options[:default_scope] && table_exists? && column_names.include?("deleted_at")
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
- default_scope :conditions => conditions
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
@@ -1,3 +1,3 @@
1
1
  module SoftDeletion
2
- VERSION = '0.4.6'
2
+ VERSION = '0.5.0'
3
3
  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.6
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-08-24 00:00:00.000000000 Z
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: 2245798785145605998
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: 2245798785145605998
66
+ hash: 1457355893249503490
67
67
  requirements: []
68
68
  rubyforge_project:
69
69
  rubygems_version: 1.8.25