soft_deletion 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- soft_deletion (0.1.1)
4
+ soft_deletion (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/Readme.md CHANGED
@@ -14,6 +14,10 @@ Usage
14
14
  # mix into any model ...
15
15
  class User < ActiveRecord::Base
16
16
  include SoftDeletion
17
+
18
+ after_soft_delete :send_deletion_emails # Rails 2 + 3
19
+ set_callback :soft_delete, :after, :prepare_emails # Rails 3
20
+
17
21
  has_many :products
18
22
  end
19
23
 
@@ -34,6 +38,7 @@ Usage
34
38
  user.soft_undelete!
35
39
  user.products.count == 10
36
40
 
41
+
37
42
  TODO
38
43
  ====
39
44
  - Rails 3 from with inspiration from https://github.com/JackDanger/permanent_records/blob/master/lib/permanent_records.rb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/soft_deletion
3
3
  specs:
4
- soft_deletion (0.1.0)
4
+ soft_deletion (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mgrosser/code/tools/soft_deletion
3
3
  specs:
4
- soft_deletion (0.1.0)
4
+ soft_deletion (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -14,8 +14,8 @@ module SoftDeletion
14
14
  if ActiveRecord::VERSION::MAJOR > 2
15
15
  base.define_callbacks :soft_delete
16
16
  class << base
17
- def after_soft_delete(callback)
18
- set_callback :soft_delete, :after, callback
17
+ def after_soft_delete(*callbacks)
18
+ set_callback :soft_delete, :after, *callbacks
19
19
  end
20
20
  end
21
21
  else
@@ -1,3 +1,3 @@
1
1
  module SoftDeletion
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -95,8 +95,15 @@ class SoftDeletionTest < ActiveSupport::TestCase
95
95
  category.soft_delete!
96
96
  end
97
97
 
98
+ should "be call multiple after soft-deletion" do
99
+ Category.after_soft_delete :foo, :bar
100
+ category = Category.create!
101
+ category.expects(:foo)
102
+ category.expects(:bar)
103
+ category.soft_delete!
104
+ end
105
+
98
106
  should "not be called after normal destroy" do
99
- # TODO clear all callbacks
100
107
  Category.after_soft_delete :foo
101
108
  category = Category.create!
102
109
  category.expects(:foo).never
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soft_deletion
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - ZenDesk
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-02 00:00:00 Z
18
+ date: 2012-05-03 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: