action-draft 0.3.1 → 0.4.0
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/README.md +1 -1
- data/lib/action-draft/attribute.rb +5 -4
- data/lib/action-draft/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7c1a6c60d09026ff1f88c61315b617311ab277935c3da803b04f3dc758e0f0
|
4
|
+
data.tar.gz: 8632c120cf9a5317c83bacb7fac7666f9adad8b45ec89214baaec6f39db5e8a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f813dadba8f5a4f6933ea4c57841af8adc4348471481607a6193785e946e3eb52eb3a7b055ba3df13c55c5f48b20fac39694406a64dcb24dc45db18a798e5f22
|
7
|
+
data.tar.gz: 9e6f06eac2cd3e8a59c2c1982ae2d9745d6d32732f405399e2f4fce9946df0032969e84cc201db0a6bf073af9c9694e74f2ef70990f3ddf2bf8cfb88c0b57bef
|
data/README.md
CHANGED
@@ -5,17 +5,18 @@ module ActionDraft
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
mattr_accessor :action_draft_attributes
|
9
8
|
end
|
10
9
|
|
11
10
|
def apply_draft
|
12
|
-
self.action_draft_attributes ||= []
|
13
|
-
self.action_draft_attributes.each do |_name|
|
11
|
+
self.class.action_draft_attributes ||= []
|
12
|
+
self.class.action_draft_attributes.each do |_name|
|
14
13
|
self.send("#{_name}=", self.send("draft_#{_name}").to_s)
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
class_methods do
|
18
|
+
attr_accessor :action_draft_attributes
|
19
|
+
|
19
20
|
# Provides access to a dependent ActionDraft::Content model that holds the draft attributes.
|
20
21
|
# This dependent attribute is lazily instantiated and will be auto-saved when it's been changed. Example:
|
21
22
|
#
|
@@ -55,7 +56,7 @@ module ActionDraft
|
|
55
56
|
end
|
56
57
|
|
57
58
|
after_save do
|
58
|
-
self.action_draft_attributes.each do |name|
|
59
|
+
self.class.action_draft_attributes.each do |name|
|
59
60
|
public_send("draft_#{name}").save if public_send("draft_#{name}").changed?
|
60
61
|
end
|
61
62
|
end
|
data/lib/action-draft/version.rb
CHANGED