redcrumbs 0.1.3 → 0.1.6

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.
@@ -8,22 +8,21 @@ module Redcrumbs
8
8
  end
9
9
 
10
10
  def watched_changes
11
- changes.reject {|k,v| !self.class.redcrumbs_options[:only].include?(k.to_sym)}
11
+ changes.slice(*self.class.redcrumbs_options[:only])
12
12
  end
13
13
 
14
14
  def storeable_attributes
15
15
  attributes.reject {|k,v| !self.class.redcrumbs_options[:store].include?(k.to_sym)}
16
16
  end
17
-
18
- def watched_changes_empty?
19
- watched_changes.empty?
17
+
18
+ def create_crumb
19
+ n = Crumb.build_with_modifications(self)
20
+ n.save
20
21
  end
21
-
22
+
23
+ # This is called after the record is saved to store the changes on the model, including anything done in before_save validations
22
24
  def notify_changes
23
- n = Crumb.build_with_modifications(self) unless watched_changes.empty?
24
- yield
25
- n.set_context_from(self) unless !n
26
- n.save unless !n
25
+ create_crumb unless watched_changes.empty?
27
26
  end
28
27
  end
29
28
  end
@@ -1,3 +1,3 @@
1
1
  module Redcrumbs
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.6"
3
3
  end
data/lib/redcrumbs.rb CHANGED
@@ -49,13 +49,15 @@ module Redcrumbs
49
49
 
50
50
  module ClassMethods
51
51
  def redcrumbed(options = {})
52
+
52
53
  include Options
53
54
  include Users
54
55
  include Creation
55
56
 
56
57
  prepare_redcrumbed_options(options)
57
58
 
58
- around_save :notify_changes, self.redcrumbs_callback_options
59
+ after_save :notify_changes
60
+
59
61
  end
60
62
  end
61
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redcrumbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-31 00:00:00.000000000 +01:00
12
+ date: 2012-06-07 00:00:00.000000000 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: data_mapper
17
- requirement: &2157900720 !ruby/object:Gem::Requirement
17
+ requirement: &2166207920 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 1.2.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2157900720
25
+ version_requirements: *2166207920
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: dm-redis-adapter
28
- requirement: &2157900220 !ruby/object:Gem::Requirement
28
+ requirement: &2166207420 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 0.6.2
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2157900220
36
+ version_requirements: *2166207420
37
37
  description: Fast and unobtrusive activity tracking of ActiveRecord models using DataMapper
38
38
  and Redis
39
39
  email: