delayed_after_commit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/lib/delayed_after_commit.rb +1 -2
- data/lib/delayed_after_commit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d476b7b79252c2e4152a2bc4cb5b84ba78a0cde
|
4
|
+
data.tar.gz: 16e0661a0db4e68113c681b57d371457068dfb5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92d9d6e6f977224ba24e7295b09eabae4f0726b6cf9817a3435aae03ed6a03d7e2cd51ca965871c752ed25d6bdc531e2b17d0bcf078ef75f0d3e4e49431a8bb
|
7
|
+
data.tar.gz: 15fa192068b717dc42d2cf7431079593ccde2f65bf42973ab0bbe29917013b8e4c7338d7f094cb9be06979b5d111dfa3e13ae72d6c98f88d4ebe87736814bd39
|
data/README.md
CHANGED
@@ -30,8 +30,16 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
class User < ActiveRecord::Base
|
32
32
|
include DelayedAfterCommit
|
33
|
-
delayed_on_update :
|
34
|
-
delayed_on_create :
|
33
|
+
delayed_on_update :hi_ive_been_updated
|
34
|
+
delayed_on_create :hi_im_new_around_here
|
35
|
+
|
36
|
+
def hi_ive_been_updated
|
37
|
+
puts "Hi - I've been updated"
|
38
|
+
end
|
39
|
+
|
40
|
+
def hi_ive_been_updated
|
41
|
+
puts "Hi - I've just been created"
|
42
|
+
end
|
35
43
|
end
|
36
44
|
|
37
45
|
```
|
data/lib/delayed_after_commit.rb
CHANGED
@@ -20,10 +20,9 @@ module DelayedAfterCommit
|
|
20
20
|
end
|
21
21
|
|
22
22
|
protected
|
23
|
-
def delayed_after_commit(method, on:
|
23
|
+
def delayed_after_commit(method, on:)
|
24
24
|
# this creates a method that runs `enqueue_delayed_method`
|
25
25
|
# it then adds that method to the after_commit callback
|
26
|
-
on ||= :update
|
27
26
|
delayed_method_name = "delayed_after_#{on}_#{method}"
|
28
27
|
define_method(delayed_method_name) do |m = method|
|
29
28
|
self.class.delay.enqueue_delayed_method(m, self.id)
|