kamikakushi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kamikakushi.rb +17 -1
- data/lib/kamikakushi/version.rb +1 -1
- metadata +2 -3
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8a310cf0ed6ab2643b8a14d0276a5aed7e21727
|
4
|
+
data.tar.gz: 54a80dfe9367e5957c4b456e258c0c9c010609ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95ee513c1f006f860480ee18e293a95601a576d48cb72cef76cea4008eac4bebd950069dcbc6a1d37095a4fa488a8895690705ee946404076aba160d4bece742
|
7
|
+
data.tar.gz: fe96e4e6014cec34e2ed50f4a5c91a8986f9d437d81e70c57501b27b8dc119f6e7043a094d052e73fb0106acb8dd147b55115c1757363e77c75d33dba51c0175
|
data/lib/kamikakushi.rb
CHANGED
@@ -2,9 +2,21 @@ module Kamiakushi
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
included do
|
5
|
-
default_scope {
|
5
|
+
default_scope { without_deleted }
|
6
6
|
alias_method_chain :destroy, :kamikakushi
|
7
7
|
alias_method_chain :destroyed?, :kamikakushi
|
8
|
+
|
9
|
+
scope :with_deleted, -> {
|
10
|
+
unscope(where: :deleted_at)
|
11
|
+
}
|
12
|
+
|
13
|
+
scope :without_deleted, -> {
|
14
|
+
where(deleted_at: nil)
|
15
|
+
}
|
16
|
+
|
17
|
+
scope :only_deleted, -> {
|
18
|
+
with_deleted.where.not(deleted_at: nil)
|
19
|
+
}
|
8
20
|
end
|
9
21
|
|
10
22
|
def destroy_with_kamikakushi
|
@@ -18,4 +30,8 @@ module Kamiakushi
|
|
18
30
|
def restore
|
19
31
|
update_column(:deleted_at, self.deleted_at = nil)
|
20
32
|
end
|
33
|
+
|
34
|
+
def destroy!
|
35
|
+
destroy_without_kamikakushi
|
36
|
+
end
|
21
37
|
end
|
data/lib/kamikakushi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamikakushi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ppworks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -46,7 +46,6 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- MIT-LICENSE
|
49
|
-
- README.rdoc
|
50
49
|
- Rakefile
|
51
50
|
- lib/kamikakushi.rb
|
52
51
|
- lib/kamikakushi/version.rb
|
data/README.rdoc
DELETED