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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fee2f0dc1bd343d1fed1f7f6a8975489941e9cd4
4
- data.tar.gz: 130b09b384812af35ad64c1e53d6b5ea5f1b86b3
3
+ metadata.gz: a8a310cf0ed6ab2643b8a14d0276a5aed7e21727
4
+ data.tar.gz: 54a80dfe9367e5957c4b456e258c0c9c010609ee
5
5
  SHA512:
6
- metadata.gz: e68415eb18bb84912ff4f8c1a09db60ee64a0186a40a0ab60c413503c45c0a62f558efe0f2c8a1f5ce46d15052cf9ea1fef74c1ade664e365b909714632e1065
7
- data.tar.gz: 68d506b82ab11a28699380f9d5a48f0ba4d5c7e37a59da30f5e28abf95b96c41bc797c8bb59625ddf31544bf159094b0086d8139ad6b7ffefced9c31f3793896
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 { where(deleted_at: nil) }
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
@@ -1,3 +1,3 @@
1
1
  module Kamiakushi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-23 00:00:00.000000000 Z
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
@@ -1,3 +0,0 @@
1
- = Kamiakushi
2
-
3
- This project rocks and uses MIT-LICENSE.