drafting 0.1.1 → 0.2.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
  SHA1:
3
- metadata.gz: 88b15d49a289bae4e3b54fd33020792a23c8383e
4
- data.tar.gz: 3a23d7a0924d227f79df9dcdc2c486ab14763160
3
+ metadata.gz: 584bd74179c43b3e4a394351a2960d7bd61c95fa
4
+ data.tar.gz: 61be0d4f73ce8309d93c6469d6c891a45290c11a
5
5
  SHA512:
6
- metadata.gz: cc5a190a3a9d2219f8fd410bb7bfedce0128e21611812d63a1c3c5e07a532be390cf3d583e6e674e7321641ace0daf0e090d68f7d35647dad7918d863b8975e3
7
- data.tar.gz: c0e3576d2e7b78b7042a9e7e0af119290ab3131e10585661de9bf35bbfdf3a512b35cef8380c22063bd851d8bc2abbccb6274925be619c1c4196f5fa939e7c83
6
+ metadata.gz: 42dc06da36af1230c2629e4907c23117e5e13092768d724c3a9b7b14f346a148a3154b6d3456768f6ba9e7f2deb8061a4ca0538736c08a8ab3e903bbf599425e
7
+ data.tar.gz: 5a6accada57fa8ea9d938634325491405a116b19faf12e678c434c0507ffd73a37dfb65beb1ec29b54c306952457415a736d07b32bc4720fb2e5b8fbe7a60d3b
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
3
+ - 2.2
4
4
  before_install: gem install bundler -v 1.10.6
data/README.md CHANGED
@@ -77,6 +77,9 @@ message.save_draft(current_user)
77
77
  # Time passes ...
78
78
 
79
79
  draft = topic.drafts(current_user).first
80
+ # or
81
+ draft = Topic.child_drafts(current_user).first
82
+
80
83
  message = draft.restore
81
84
  message.save!
82
85
  ```
@@ -13,8 +13,14 @@ module Drafting
13
13
  raise ArgumentError unless parent_class
14
14
 
15
15
  unless parent_class.method_defined? :drafts
16
- parent_class.send :define_method, :drafts do |user|
17
- Draft.where(:user => user, :parent => self)
16
+ parent_class.class_eval do
17
+ def drafts(user)
18
+ Draft.where(:user => user, :parent => self)
19
+ end
20
+
21
+ def self.child_drafts(user)
22
+ Draft.where(:user => user, :parent_type => self)
23
+ end
18
24
  end
19
25
  end
20
26
 
@@ -1,3 +1,3 @@
1
1
  module Drafting
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drafting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Ledermann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord