acts_as_removable 0.9.2 → 0.9.3
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 +1 -1
- data/lib/acts_as_removable/version.rb +1 -1
- data/lib/acts_as_removable.rb +14 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40644a9e4bae02831511dbbb1517df55c23ec01d
|
4
|
+
data.tar.gz: f5009cf18a4fae3a2ba273a09c82bf070a415543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fa89d369aabf5c7ad13b6012c11fa6236c40cba1a041550b49526d99a12c74c85a4c5626fd10624f0d60a125b73dd96e192c1ad4edd01ef0d01f5c9f47e40a7
|
7
|
+
data.tar.gz: 3c3d9df0798534c7cd997c1d309602d1f885d754433113e11de79f015cae09727002d65674627653e9cde0e5c829267cfaf5c0e356dafe08ba1e0c3ec468686e
|
data/acts_as_removable.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'acts_as_removable/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "acts_as_removable"
|
8
8
|
spec.version = ActsAsRemovable::VERSION
|
9
|
-
spec.authors = ["Florian Schwab"]
|
9
|
+
spec.authors = ["Florian Schwab", "Erik Ernst"]
|
10
10
|
spec.email = ["florian.schwab@sic-software.com"]
|
11
11
|
spec.description = %q{Simplifies handling of pseudo removed records}
|
12
12
|
spec.summary = %q{Simplifies handling of pseudo removed records}
|
data/lib/acts_as_removable.rb
CHANGED
@@ -28,11 +28,21 @@ module ActsAsRemovable
|
|
28
28
|
@_acts_as_removable_column_name
|
29
29
|
end
|
30
30
|
|
31
|
-
scope :removed, -> {
|
32
|
-
|
33
|
-
|
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
|
35
|
+
}
|
34
36
|
|
35
|
-
|
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
|
41
|
+
}
|
42
|
+
|
43
|
+
default_scope -> {where(all.table[self._acts_as_removable_column_name].eq(nil).to_sql)} unless options[:without_default_scope]
|
44
|
+
|
45
|
+
define_model_callbacks :remove, :unremove
|
36
46
|
|
37
47
|
def self.before_remove(*args, &block)
|
38
48
|
set_callback :remove, :before, *args, &block
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Schwab
|
8
|
+
- Erik Ernst
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-
|
12
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activesupport
|