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 +4 -4
- data/acts_as_removable.gemspec +6 -6
- data/lib/acts_as_removable/version.rb +1 -1
- data/lib/acts_as_removable.rb +12 -6
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc13acf0ef4676070b9c1b58df18af874be7940
|
4
|
+
data.tar.gz: f25399054b7cab95fd0489cd0e88a6685a90997d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d390b4ccf8503d4554d1efb90a750675d83af09a65cb25b578d04996031f328ef904f3a82721bbde4727f4919a7b06d28ab97f87b2d3869a9693bc80088e8daa
|
7
|
+
data.tar.gz: 0e79c8d9d8ec1ac4d9e56aa111b16965aaa4455d734e0c057ca8dda37d541073ea3226d81093a231f6b2da1ad5d28375b18a71040b899117f4d035f38d58ffda
|
data/acts_as_removable.gemspec
CHANGED
@@ -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
|
22
|
-
spec.add_dependency
|
21
|
+
spec.add_dependency 'activesupport', '> 4.0.0'
|
22
|
+
spec.add_dependency 'activerecord', '> 4.0.0'
|
23
23
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
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
|
data/lib/acts_as_removable.rb
CHANGED
@@ -29,15 +29,15 @@ module ActsAsRemovable
|
|
29
29
|
end
|
30
30
|
|
31
31
|
scope :removed, -> {
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
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.
|
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:
|
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.
|
137
|
+
rubygems_version: 2.2.2
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Simplifies handling of pseudo removed records
|