after-commit-on-action 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/after-commit-on-action.gemspec +2 -2
- data/lib/after-commit-on-action.rb +17 -4
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 189507c06941a49a9554380a81b956f0793ee0e1
|
4
|
+
data.tar.gz: eb04383070c0318d4815188b7f00a59e28d01c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d4b1f4cbc4b0497a8246ef4264f6b3400750c5194207e86e996239ab832490d6f4f53e2035b00d127a7c02d2b1281be36e1c6ba75f26c1a05e967897e09367f
|
7
|
+
data.tar.gz: fb7c19eb2080bb980d14004ae8eb9b3ed8837050473ee02029cc85d272dac5cae82da67d35a8c5c0a2fb73a957a2fbd8d7a6282955303f670080fe9adf17f5b6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'after-commit-on-action'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '
|
3
|
+
s.version = '0.0.3'
|
4
|
+
s.date = '2016-04-06'
|
5
5
|
s.summary = "Adds callbacks such as after_commit_on_create, after_commit_on_update to your ActiveRecord objects and observers."
|
6
6
|
s.description = "Adds the following callbacks to your ActiveRecord objects and observers: after_commit_on_create, after_commit_on_update, after_commit_on_save, after_commit_on_destroy."
|
7
7
|
s.authors = ["Yunus Sasmaz"]
|
@@ -2,10 +2,23 @@ module AfterCommitOnAction
|
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
4
|
included do
|
5
|
-
after_commit(on: :create)
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
after_commit(on: :create) do |obj|
|
6
|
+
obj.send :notify_observers, :after_commit_on_create
|
7
|
+
end
|
8
|
+
|
9
|
+
after_commit(on: :update) do |obj|
|
10
|
+
obj.send :notify_observers, :after_commit_on_update
|
11
|
+
end
|
12
|
+
|
13
|
+
# Without the `if: :persisted?` condition,
|
14
|
+
# this callback would be fired on destroy as well.
|
15
|
+
after_commit(if: :persisted?) do |obj|
|
16
|
+
obj.send :notify_observers, :after_commit_on_save
|
17
|
+
end
|
18
|
+
|
19
|
+
after_commit(on: :destroy) do |obj|
|
20
|
+
obj.send :notify_observers, :after_commit_on_destroy
|
21
|
+
end
|
9
22
|
end
|
10
23
|
end
|
11
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after-commit-on-action
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yunus Sasmaz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -81,10 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.4.7
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Adds callbacks such as after_commit_on_create, after_commit_on_update to
|
88
88
|
your ActiveRecord objects and observers.
|
89
89
|
test_files: []
|
90
|
-
has_rdoc:
|