kentouzu 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.2
2
+
3
+ * Added callbacks for `before_draft_save`, `after_draft_save`, and `around_draft_save`.
4
+
1
5
  ## v0.1.1
2
6
 
3
7
  * Fixed a bug in the `has_many :drafts` association for Rails 4. Since it uses a lambda for the order scope `self` is the class `has_drafts` was called in.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kentouzu (0.1.1)
4
+ kentouzu (0.1.2)
5
5
  activerecord (>= 3.0)
6
6
  railties (>= 3.0)
7
7
 
@@ -8,6 +8,8 @@ module Kentouzu
8
8
  def has_drafts(options = {})
9
9
  send :include, InstanceMethods
10
10
 
11
+ send :define_model_callbacks, :draft_save
12
+
11
13
  class_attribute :draft_association_name
12
14
  self.draft_association_name = options[:draft] || :draft
13
15
 
@@ -105,10 +107,14 @@ module Kentouzu
105
107
  :source_id => Kentouzu.source.present? ? Kentouzu.source.id : nil,
106
108
  :object => self.to_yaml
107
109
  }
108
- data.merge!(Kentouzu.controller_info || {})
110
+
111
+ data.merge!(Kentouzu.controller_info.slice(:item_type, :item_id, :event, :source_type, :source_id) || {})
109
112
 
110
113
  draft = Draft.new(data)
111
- draft.save
114
+
115
+ run_callbacks :draft_save do
116
+ draft.save
117
+ end
112
118
  else
113
119
  default_save.bind(self).call
114
120
  end
@@ -1,3 +1,3 @@
1
1
  module Kentouzu
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kentouzu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-16 00:00:00.000000000 Z
12
+ date: 2014-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -259,7 +259,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
259
259
  version: '0'
260
260
  segments:
261
261
  - 0
262
- hash: -3408346045829337551
262
+ hash: -3194602278824882459
263
263
  required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  none: false
265
265
  requirements:
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  version: '0'
269
269
  segments:
270
270
  - 0
271
- hash: -3408346045829337551
271
+ hash: -3194602278824882459
272
272
  requirements: []
273
273
  rubyforge_project: kentouzu
274
274
  rubygems_version: 1.8.25