action-draft 0.3.1 → 0.4.0

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
  SHA256:
3
- metadata.gz: d0663c5899dfa3deaa7974c91877a549cc2525cbd0b3020275984701fb5fde44
4
- data.tar.gz: 13fd5fe0a96ae4de820b8ce1b64ad28b36749998b932ab835500ff1252725773
3
+ metadata.gz: cc7c1a6c60d09026ff1f88c61315b617311ab277935c3da803b04f3dc758e0f0
4
+ data.tar.gz: 8632c120cf9a5317c83bacb7fac7666f9adad8b45ec89214baaec6f39db5e8a8
5
5
  SHA512:
6
- metadata.gz: e7abdc6ff381d01ae876253202f52173b29b7ee65c39336cfd74ddd3cf81b58854697535b38a14aab55bdbf7186b37be3b7ec4b8cf7158cf89b768e67cc3427e
7
- data.tar.gz: 66f0d8291ca0b05fda025fdb535d156dd5683f76eead1397af7d8d757867df0d027d145780a875f0cec142856cae4273ea4dde2b9a92bad791d147da7e280a29
6
+ metadata.gz: f813dadba8f5a4f6933ea4c57841af8adc4348471481607a6193785e946e3eb52eb3a7b055ba3df13c55c5f48b20fac39694406a64dcb24dc45db18a798e5f22
7
+ data.tar.gz: 9e6f06eac2cd3e8a59c2c1982ae2d9745d6d32732f405399e2f4fce9946df0032969e84cc201db0a6bf073af9c9694e74f2ef70990f3ddf2bf8cfb88c0b57bef
data/README.md CHANGED
@@ -20,7 +20,7 @@ gem "action-draft"
20
20
  And then execute:
21
21
  ```bash
22
22
  $ bundle
23
- $ rails action_draft:install
23
+ $ rails action_draft:install:migrations
24
24
  ```
25
25
 
26
26
  ## Usage
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionDraft
4
- VERSION = "0.3.1"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action-draft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee