acts_as_removable 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40644a9e4bae02831511dbbb1517df55c23ec01d
4
- data.tar.gz: f5009cf18a4fae3a2ba273a09c82bf070a415543
3
+ metadata.gz: dcc13acf0ef4676070b9c1b58df18af874be7940
4
+ data.tar.gz: f25399054b7cab95fd0489cd0e88a6685a90997d
5
5
  SHA512:
6
- metadata.gz: 2fa89d369aabf5c7ad13b6012c11fa6236c40cba1a041550b49526d99a12c74c85a4c5626fd10624f0d60a125b73dd96e192c1ad4edd01ef0d01f5c9f47e40a7
7
- data.tar.gz: 3c3d9df0798534c7cd997c1d309602d1f885d754433113e11de79f015cae09727002d65674627653e9cde0e5c829267cfaf5c0e356dafe08ba1e0c3ec468686e
6
+ metadata.gz: d390b4ccf8503d4554d1efb90a750675d83af09a65cb25b578d04996031f328ef904f3a82721bbde4727f4919a7b06d28ab97f87b2d3869a9693bc80088e8daa
7
+ data.tar.gz: 0e79c8d9d8ec1ac4d9e56aa111b16965aaa4455d734e0c057ca8dda37d541073ea3226d81093a231f6b2da1ad5d28375b18a71040b899117f4d035f38d58ffda
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "activesupport", "~> 4.0.0"
22
- spec.add_dependency "activerecord", "~> 4.0.0"
21
+ spec.add_dependency 'activesupport', '> 4.0.0'
22
+ spec.add_dependency 'activerecord', '> 4.0.0'
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.3"
25
- spec.add_development_dependency "rake"
26
- spec.add_development_dependency "rspec"
27
- spec.add_development_dependency "sqlite3"
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'sqlite3'
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsRemovable
2
- VERSION = "0.9.3"
2
+ VERSION = '0.9.4'
3
3
  end
@@ -29,15 +29,15 @@ module ActsAsRemovable
29
29
  end
30
30
 
31
31
  scope :removed, -> {
32
- s = where(all.table[self._acts_as_removable_column_name].not_eq(nil).to_sql).with_default_scope
33
- s.where_values.delete(all.table[self._acts_as_removable_column_name].eq(nil).to_sql)
34
- s
32
+ removed_at_column_name = self._acts_as_removable_column_name
33
+ query = where(all.table[removed_at_column_name].not_eq(nil).to_sql)
34
+ ::ActsAsRemovable.removable_where_values(query, removed_at_column_name, all.table[removed_at_column_name].eq(nil).to_sql)
35
35
  }
36
36
 
37
37
  scope :actives, -> {
38
- s = where(all.table[self._acts_as_removable_column_name].eq(nil).to_sql).with_default_scope
39
- s.where_values.delete(all.table[self._acts_as_removable_column_name].not_eq(nil).to_sql)
40
- s
38
+ removed_at_column_name = self._acts_as_removable_column_name
39
+ query = where(all.table[removed_at_column_name].eq(nil).to_sql)
40
+ ::ActsAsRemovable.removable_where_values(query, removed_at_column_name, all.table[removed_at_column_name].not_eq(nil).to_sql)
41
41
  }
42
42
 
43
43
  default_scope -> {where(all.table[self._acts_as_removable_column_name].eq(nil).to_sql)} unless options[:without_default_scope]
@@ -92,6 +92,12 @@ module ActsAsRemovable
92
92
  end
93
93
  end
94
94
 
95
+ # Helps deleting where statements from query
96
+ def self.removable_where_values(query, column_name, remove_where)
97
+ query = query.with_default_scope if query.respond_to?(:with_default_scope)
98
+ query.where_values.delete(remove_where)
99
+ query
100
+ end
95
101
  end
96
102
 
97
103
  ActiveRecord::Base.send(:include, ActsAsRemovable)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_removable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
@@ -9,34 +9,34 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-20 00:00:00.000000000 Z
12
+ date: 2014-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - '>'
19
19
  - !ruby/object:Gem::Version
20
20
  version: 4.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - '>'
26
26
  - !ruby/object:Gem::Version
27
27
  version: 4.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - '>'
33
33
  - !ruby/object:Gem::Version
34
34
  version: 4.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - '>'
40
40
  - !ruby/object:Gem::Version
41
41
  version: 4.0.0
42
42
  - !ruby/object:Gem::Dependency
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  version: '0'
135
135
  requirements: []
136
136
  rubyforge_project:
137
- rubygems_version: 2.0.3
137
+ rubygems_version: 2.2.2
138
138
  signing_key:
139
139
  specification_version: 4
140
140
  summary: Simplifies handling of pseudo removed records